diff --git a/core/includes/theme.inc b/core/includes/theme.inc index e675fc2..3b03dae 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2852,9 +2852,35 @@ function template_preprocess_page(&$variables) { $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin($site_config->get('slogan')) : ''); $variables['tabs'] = menu_local_tabs(); - // @todo: move this into the template with an inclusion of list.twig or menu.twig - $variables['main_menu'] = theme('links__system_main_menu', array('links' => $variables['main_menu'], 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'class' => array('element-invisible')))); - $variables['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $variables['secondary_menu'], 'attributes' => array('id' => 'secondary-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'class' => array('element-invisible')))); + // Pass the main menu and secondary menu to the template as render arrays. + if (!empty($variables['main_menu'])) { + $variables['main_menu'] = array( + '#theme' =>'links__system_main_menu', + '#links' => $variables['main_menu'], + '#attributes' => array( + 'id' => 'main-menu', + 'class' => array('links', 'inline', 'clearfix'), + ), + '#heading' => array( + 'text' => t('Main menu'), + 'class' => array('element-invisible'), + ) + ); + } + if (!empty($variables['secondary_menu'])) { + $variables['secondary_menu'] = array( + '#theme' =>'links__system_secondary_menu', + '#links' => $variables['secondary_menu'], + '#attributes' => array( + 'id' => 'secondary-menu', + 'class' => array('links', 'inline', 'clearfix'), + ), + '#heading' => array( + 'text' => t('Secondary menu'), + 'class' => array('element-invisible'), + ) + ); + } if ($node = menu_get_object()) { $variables['node'] = $node; diff --git a/core/modules/block/tests/themes/block_test_theme/page.html.twig b/core/modules/block/tests/themes/block_test_theme/page.html.twig index 4d3c599..a4ca091 100755 --- a/core/modules/block/tests/themes/block_test_theme/page.html.twig +++ b/core/modules/block/tests/themes/block_test_theme/page.html.twig @@ -44,9 +44,15 @@ {% if main_menu is defined or secondary_menu is defined %}
{% endif %} diff --git a/core/modules/system/templates/page.html.twig b/core/modules/system/templates/page.html.twig index 8eaa361..4b0c33e 100644 --- a/core/modules/system/templates/page.html.twig +++ b/core/modules/system/templates/page.html.twig @@ -108,14 +108,20 @@