Я работаю с drupal 8. Я включил отладку и обнаружил [
<!-- BEGIN OUTPUT from ‘core/themes/stable/templates/dataset/table.html.twig’ --> ]
, затем перезаписал таблицу. html .twig в папке моей темы. Теперь в теге есть ссылка, которую я хочу добавить [/ edit] к нему. чтобы пользователь перешел на страницу редактирования. следующий код взят из основного файла.
<tbody>
{% for row in rows %}
<tr{{ row.attributes }}>
{% for cell in row.cells %}
<{{ cell.tag }}{{ cell.attributes }}>
{{- cell.content -}}
</{{ cell.tag }}>
{% endfor %}
</tr>
{% endfor %}
</tbody>
Я пытаюсь создать функцию предварительной обработки
/* this preprocess method is to add variables to table.html.twig*/
function mytheme_preprocess_table(&$variables) {
print_r(array_keys($variables));
$variables['output'] = "add your custom";
$variables['hello'] = 'world';
}
, но я не знаю, как получить доступ к [cell.content], чтобы добавить [/ edit]
Как создается таблица? это из кода. Где отображается таблица? в https://example.com/ar/webform/companies_form/submissions/
Каков путь «редактировать страницу веб-формы»? webform/companies_form/submissions/3119/edit
Вы отладили шаблон, чтобы увидеть, какие переменные доступны в шаблоне? да,
Array
(
[0] => header
[1] => rows
[2] => attributes
[3] => sticky
[4] => responsive
[5] => empty
[6] => footer
[7] => caption
[8] => colgroups
[9] => theme_hook_original
[10] => title_attributes
[11] => content_attributes
[12] => title_prefix
[13] => title_suffix
[14] => db_is_active
[15] => is_admin
[16] => logged_in
[17] => user
[18] => directory
[19] => header_columns
[20] => no_striping
[21] => #cache
)