这是page.html.twig文件的一部分
<div class="content col-lg-{{ page.main_content_width }} col-md-{{ page.main_content_width }} col-sm-12 col-xs-12">
{{ page.highlighted }}
{{ title_prefix }}
{% if title %}
<h1>{{ title }}</h1>
{% endif %}
{{ title_suffix }}
{{ tabs }}
{% if action_links %}
<nav class="action-links">{{ action_links }}</nav>
{% endif %}
{{ page.content }}
{{ feed_icons }}
</div>
主题中没有名为突出显示的块区域。 这些变量存储在哪里。我找不到这个twig文件的php模板文件
答案 0 :(得分:0)
这些变量是用可渲染数组生成的,您可以随时在相应的预处理挂钩中更改/查看它们。在您的情况下,hook_preprocess_page
将向您显示树枝中使用的所有变量。
并回答您设置这些值的位置,文件 /core/includes/theme.inc
function template_preprocess_page
正在准备这些变量。
function template_preprocess_page(&$variables) {
$language_interface = \Drupal::languageManager()
->getCurrentLanguage();
foreach (\Drupal::theme()
->getActiveTheme()
->getRegions() as $region) {
if (!isset($variables['page'][$region])) {
$variables['page'][$region] = array();
}
}
$variables['base_path'] = base_path();
$variables['front_page'] = \Drupal::url('<front>');
$variables['language'] = $language_interface;
// An exception might be thrown.
try {
$variables['is_front'] = \Drupal::service('path.matcher')
->isFrontPage();
} catch (Exception $e) {
// If the database is not yet available, set default values for these
// variables.
$variables['is_front'] = FALSE;
$variables['db_is_active'] = FALSE;
}
if ($node = \Drupal::routeMatch()
->getParameter('node')) {
$variables['node'] = $node;
}
}