core/config/schema/core.data_types.schema.yml | 6 - core/includes/common.inc | 14 -- core/includes/menu.inc | 85 ------------ core/includes/theme.inc | 24 ---- core/lib/Drupal/Core/Extension/ThemeHandler.php | 4 +- .../Core/Menu/DefaultMenuLinkTreeManipulators.php | 27 ---- core/modules/block/src/Tests/BlockHtmlTest.php | 2 +- core/modules/block/src/Tests/BlockUiTest.php | 2 +- .../menu_ui/config/install/menu_ui.settings.yml | 2 - .../menu_ui/config/schema/menu_ui.schema.yml | 6 - core/modules/menu_ui/menu_ui.links.task.yml | 6 - core/modules/menu_ui/menu_ui.routing.yml | 8 -- core/modules/menu_ui/src/MenuSettingsForm.php | 73 ---------- core/modules/menu_ui/src/Tests/MenuNodeTest.php | 5 +- core/modules/menu_ui/src/Tests/MenuTest.php | 7 - .../src/Tests/Dump/Drupal6MenuSettings.php | 8 -- .../src/Tests/d6/MigrateMenuConfigsTest.php | 2 - .../system/config/install/system.theme.global.yml | 2 - core/modules/system/src/Form/ThemeSettingsForm.php | 2 - .../Tests/Cache/PageCacheTagsIntegrationTest.php | 10 ++ .../system/src/Tests/Menu/BreadcrumbTest.php | 2 +- .../system/src/Tests/System/PageTitleTest.php | 2 - core/modules/system/system.module | 21 ++- .../templates/block--system-menu-block.html.twig | 72 ++++++++++ core/modules/system/templates/menu-tree.html.twig | 23 +--- core/modules/system/templates/page.html.twig | 15 +- .../user/src/Tests/UserAccountLinksTests.php | 4 + .../user/src/Tests/UserPasswordResetTest.php | 12 ++ .../views/src/Tests/Plugin/DisplayPageWebTest.php | 4 +- core/modules/views/src/Tests/Wizard/MenuTest.php | 2 + .../install/block.block.bartik_account_menu.yml | 25 ++++ .../install/block.block.bartik_main_menu.yml | 25 ++++ .../Menu/DefaultMenuLinkTreeManipulatorsTest.php | 59 -------- core/themes/bartik/bartik.info.yml | 2 + core/themes/bartik/bartik.theme | 11 -- core/themes/bartik/css/colors.css | 6 +- core/themes/bartik/css/layout.css | 6 +- core/themes/bartik/css/style.css | 151 ++++++++++----------- .../templates/block--system-menu-block.html.twig | 21 +++ core/themes/bartik/templates/page.html.twig | 29 ++-- core/themes/seven/templates/page.html.twig | 3 - 41 files changed, 290 insertions(+), 500 deletions(-) diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index 354cf2e..3615197 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -161,12 +161,6 @@ theme_settings: node_user_picture: type: boolean label: 'User pictures in posts' - main_menu: - type: boolean - label: 'Main menu' - secondary_menu: - type: boolean - label: 'Secondary menu' slogan: type: boolean label: 'Site slogan' diff --git a/core/includes/common.inc b/core/includes/common.inc index 3b6f1dd..abda8bf 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2487,20 +2487,6 @@ function drupal_prepare_page($page) { \Drupal::moduleHandler()->alter('page', $page); \Drupal::theme()->alter('page', $page); - // The "main" and "secondary" menus are never part of the page-level render - // array and therefore their cache tags will never bubble up into the page - // cache, even though they should be. This happens because they're rendered - // directly by the theme system. - // @todo Remove this once https://drupal.org/node/1869476 lands. - if (theme_get_setting('features.main_menu') && count(menu_main_menu())) { - $main_links_source = _menu_get_links_source('main_links', 'main'); - $page['page_top']['#cache']['tags']['menu'][$main_links_source] = $main_links_source; - } - if (theme_get_setting('features.secondary_menu') && count(menu_secondary_menu())) { - $secondary_links_source = _menu_get_links_source('secondary_links', 'account'); - $page['page_top']['#cache']['tags']['menu'][$secondary_links_source] = $secondary_links_source; - } - // If no module has taken care of the main content, add it to the page now. // This allows the site to still be usable even if no modules that // control page regions (for example, the Block module) are enabled. diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 51dcd9a..f4698d6 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -311,23 +311,6 @@ * Implements template_preprocess_HOOK() for theme_menu_tree(). */ function template_preprocess_menu_tree(&$variables) { - if (isset($variables['tree']['#heading'])) { - $variables['heading'] = $variables['tree']['#heading']; - $heading = &$variables['heading']; - // Convert a string heading into an array, using a H2 tag by default. - if (is_string($heading)) { - $heading = array('text' => $heading); - } - // Merge in default array properties into $heading. - $heading += array( - 'level' => 'h2', - 'attributes' => array(), - ); - // Convert the attributes array into an Attribute object. - $heading['attributes'] = new Attribute($heading['attributes']); - $heading['text'] = String::checkPlain($heading['text']); - } - if (isset($variables['tree']['#attributes'])) { $variables['attributes'] = new Attribute($variables['tree']['#attributes']); } @@ -337,8 +320,6 @@ function template_preprocess_menu_tree(&$variables) { if (!isset($variables['attributes']['class'])) { $variables['attributes']['class'] = array(); } - $variables['attributes']['class'][] = 'menu'; - $variables['tree'] = $variables['tree']['#children']; } @@ -472,72 +453,6 @@ function menu_list_system_menus() { } /** - * Returns an array of links to be rendered as the Main menu. - */ -function menu_main_menu() { - $main_links_source = _menu_get_links_source('main_links', 'main'); - return menu_navigation_links($main_links_source); -} - -/** - * Returns an array of links to be rendered as the Secondary links. - */ -function menu_secondary_menu() { - $main_links_source = _menu_get_links_source('main_links', 'main'); - $secondary_links_source = _menu_get_links_source('secondary_links', 'account'); - - // If the secondary menu source is set as the primary menu, we display the - // second level of the primary menu. - if ($secondary_links_source == $main_links_source) { - return menu_navigation_links($main_links_source, 1); - } - else { - return menu_navigation_links($secondary_links_source, 0); - } -} - -/** - * Returns the source of links of a menu. - * - * @param string $name - * A string configuration key of menu link source. - * @param string $default - * Default menu name. - * - * @return string - * Returns menu name, if exist - */ -function _menu_get_links_source($name, $default) { - $config = \Drupal::config('menu_ui.settings'); - return \Drupal::moduleHandler()->moduleExists('menu_ui') ? $config->get($name) : $default; -} - -/** - * Builds a renderable array for a navigation menu. - * - * @param string $menu_name - * The name of the menu. - * @param int $level - * Optional, the depth of the menu to be returned. - * - * @return array - * A renderable array. - */ -function menu_navigation_links($menu_name, $level = 0) { - $menu_tree = \Drupal::menuTree(); - $parameters = $menu_tree->getCurrentRouteMenuTreeParameters($menu_name); - $parameters->setMaxDepth($level + 1); - $tree = $menu_tree->load($menu_name, $parameters); - $manipulators = array( - array('callable' => 'menu.default_tree_manipulators:checkAccess'), - array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'), - array('callable' => 'menu.default_tree_manipulators:extractSubtreeOfActiveTrail', 'args' => array($level)), - ); - $tree = $menu_tree->transform($tree, $manipulators); - return $menu_tree->build($tree); -} - -/** * Collects the local tasks (tabs), action links, and the root path. * * @param int $level diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7a45d10..cbffb6e 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1806,8 +1806,6 @@ function template_preprocess_page(&$variables) { $variables['site_slogan'] = (theme_get_setting('features.slogan') ? Xss::filterAdmin($site_config->get('slogan')) : ''); if (!defined('MAINTENANCE_MODE')) { - $variables['main_menu'] = theme_get_setting('features.main_menu') ? menu_main_menu() : array(); - $variables['secondary_menu'] = theme_get_setting('features.secondary_menu') ? menu_secondary_menu() : array(); $variables['action_links'] = menu_get_local_actions(); $variables['tabs'] = menu_local_tabs(); @@ -1825,33 +1823,11 @@ function template_preprocess_page(&$variables) { } } else { - $variables['main_menu'] = array(); - $variables['secondary_menu'] = array(); $variables['action_links'] = array(); $variables['tabs'] = array(); $variables['feed_icons'] = ''; } - // Pass the main menu and secondary menu to the template as render arrays. - if (!empty($variables['main_menu'])) { - $variables['main_menu']['#heading'] = array( - 'text' => t('Main menu'), - 'attributes' => array( - 'id' => 'links__system_main_menu', - 'class' => array('visually-hidden'), - ), - ); - } - if (!empty($variables['secondary_menu'])) { - $variables['secondary_menu']['#heading'] = array( - 'text' => t('Secondary menu'), - 'attributes' => array( - 'id' => 'links__system_secondary_menu', - 'class' => array('visually-hidden'), - ), - ); - } - if ($node = \Drupal::routeMatch()->getParameter('node')) { $variables['node'] = $node; } diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index f42f1bd..9260f3d 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -35,8 +35,6 @@ class ThemeHandler implements ThemeHandlerInterface { 'node_user_picture', 'comment_user_picture', 'comment_user_verification', - 'main_menu', - 'secondary_menu', ); /** @@ -451,6 +449,8 @@ public function rebuildThemeData() { 'sidebar_second' => 'Right sidebar', 'content' => 'Content', 'header' => 'Header', + 'primary_menu' => 'Primary menu', + 'secondary_menu' => 'Secondary menu', 'footer' => 'Footer', 'highlighted' => 'Highlighted', 'help' => 'Help', diff --git a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php index 0d6c995..29fa9bc 100644 --- a/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php +++ b/core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php @@ -234,31 +234,4 @@ public function flatten(array $tree) { return $tree; } - /** - * Extracts a subtree of the active trail. - * - * @param \Drupal\Core\Menu\MenuLinkTreeElement[] $tree - * The menu link tree to manipulate. - * @param int $level - * The level in the active trail to extract. - * - * @return \Drupal\Core\Menu\MenuLinkTreeElement[] - * The manipulated menu link tree. - */ - public function extractSubtreeOfActiveTrail(array $tree, $level) { - // Go down the active trail until the right level is reached. - while ($level-- > 0 && $tree) { - // Loop through the current level's elements until we find one that is in - // the active trail. - while ($element = array_shift($tree)) { - if ($element->inActiveTrail) { - // If the element is in the active trail, we continue in the subtree. - $tree = $element->subtree; - break; - } - } - } - return $tree; - } - } diff --git a/core/modules/block/src/Tests/BlockHtmlTest.php b/core/modules/block/src/Tests/BlockHtmlTest.php index b6cb078..955955a 100644 --- a/core/modules/block/src/Tests/BlockHtmlTest.php +++ b/core/modules/block/src/Tests/BlockHtmlTest.php @@ -48,7 +48,7 @@ function testHtml() { $this->assertFieldByXPath('//div[@id="block-test-html-block" and @data-custom-attribute="foo"]', NULL, 'HTML ID and attributes for test block are valid and on the same DOM element.'); // Ensure expected markup for a menu block. - $elements = $this->xpath('//div[contains(@class, :div-class)]/div/ul[contains(@class, :ul-class)]/li', array(':div-class' => 'block-system', ':ul-class' => 'menu')); + $elements = $this->xpath('//nav[contains(@class, :nav-class)]/div/ul[contains(@class, :ul-class)]/li', array(':nav-class' => 'block-menu', ':ul-class' => 'menu')); $this->assertTrue(!empty($elements), 'The proper block markup was found.'); } diff --git a/core/modules/block/src/Tests/BlockUiTest.php b/core/modules/block/src/Tests/BlockUiTest.php index ebe5712..7b6f945 100644 --- a/core/modules/block/src/Tests/BlockUiTest.php +++ b/core/modules/block/src/Tests/BlockUiTest.php @@ -64,7 +64,7 @@ protected function setUp() { ), array( 'label' => 'Powered by Drupal', - 'tr' => '12', + 'tr' => '16', 'plugin_id' => 'system_powered_by_block', 'settings' => array('region' => 'footer', 'id' => 'powered'), 'test_weight' => '0', diff --git a/core/modules/menu_ui/config/install/menu_ui.settings.yml b/core/modules/menu_ui/config/install/menu_ui.settings.yml index a79ac97..c3ee6fb 100644 --- a/core/modules/menu_ui/config/install/menu_ui.settings.yml +++ b/core/modules/menu_ui/config/install/menu_ui.settings.yml @@ -1,3 +1 @@ -main_links: main -secondary_links: account override_parent_selector: false diff --git a/core/modules/menu_ui/config/schema/menu_ui.schema.yml b/core/modules/menu_ui/config/schema/menu_ui.schema.yml index 7855ba3..ed1fef8 100644 --- a/core/modules/menu_ui/config/schema/menu_ui.schema.yml +++ b/core/modules/menu_ui/config/schema/menu_ui.schema.yml @@ -4,12 +4,6 @@ menu_ui.settings: type: mapping label: 'Menu settings' mapping: - main_links: - type: string - label: 'Main links' - secondary_links: - type: string - label: 'Source for secondary links' override_parent_selector: type: boolean label: 'Override parent selector' diff --git a/core/modules/menu_ui/menu_ui.links.task.yml b/core/modules/menu_ui/menu_ui.links.task.yml index d9f1937..10dd8d0 100644 --- a/core/modules/menu_ui/menu_ui.links.task.yml +++ b/core/modules/menu_ui/menu_ui.links.task.yml @@ -7,9 +7,3 @@ menu_ui.overview_page: title: 'List' route_name: menu_ui.overview_page base_route: menu_ui.overview_page - -menu_ui.settings: - title: 'Settings' - route_name: menu_ui.settings - base_route: menu_ui.overview_page - weight: 100 diff --git a/core/modules/menu_ui/menu_ui.routing.yml b/core/modules/menu_ui/menu_ui.routing.yml index 1b431e9..97fd744 100644 --- a/core/modules/menu_ui/menu_ui.routing.yml +++ b/core/modules/menu_ui/menu_ui.routing.yml @@ -1,11 +1,3 @@ -menu_ui.settings: - path: '/admin/structure/menu/settings' - defaults: - _form: 'Drupal\menu_ui\MenuSettingsForm' - _title: 'Menus' - requirements: - _permission: 'administer menu' - menu_ui.overview_page: path: '/admin/structure/menu' defaults: diff --git a/core/modules/menu_ui/src/MenuSettingsForm.php b/core/modules/menu_ui/src/MenuSettingsForm.php deleted file mode 100644 index 9037bb5..0000000 --- a/core/modules/menu_ui/src/MenuSettingsForm.php +++ /dev/null @@ -1,73 +0,0 @@ -config('menu_ui.settings'); - $form['intro'] = array( - '#type' => 'item', - '#markup' => t('The Menu UI module allows on-the-fly creation of menu links in the content authoring forms. To configure these settings for a particular content type, visit the Content types page, click the edit link for the content type, and go to the Menu settings section.', array('@content-types' => url('admin/structure/types'))), - ); - - $menu_options = menu_ui_get_menus(); - - $main = $config->get('main_links'); - $form['menu_main_links_source'] = array( - '#type' => 'select', - '#title' => t('Source for the Main links'), - '#default_value' => $main, - '#empty_option' => t('No Main links'), - '#options' => $menu_options, - '#tree' => FALSE, - '#description' => t('Select what should be displayed as the Main links (typically at the top of the page).'), - ); - - $form['menu_secondary_links_source'] = array( - '#type' => 'select', - '#title' => t('Source for the Secondary links'), - '#default_value' => $config->get('secondary_links'), - '#empty_option' => t('No Secondary links'), - '#options' => $menu_options, - '#tree' => FALSE, - '#description' => t('Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links.', array('%main' => $main ? $menu_options[$main] : t('none'))), - ); - - return parent::buildForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->config('menu_ui.settings') - ->set('main_links', $form_state->getValue('menu_main_links_source')) - ->set('secondary_links', $form_state->getValue('menu_secondary_links_source')) - ->save(); - - parent::submitForm($form, $form_state); - } - -} diff --git a/core/modules/menu_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php index 11a1aca..fdd0e71 100644 --- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php +++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php @@ -22,10 +22,13 @@ class MenuNodeTest extends WebTestBase { * * @var array */ - public static $modules = array('menu_ui', 'test_page_test', 'node'); + public static $modules = array('menu_ui', 'test_page_test', 'node', 'block'); protected function setUp() { parent::setUp(); + + $this->drupalPlaceBlock('system_menu_block:main'); + $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); $this->admin_user = $this->drupalCreateUser(array( diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index 09bc6f4..c35d0d1 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -839,13 +839,6 @@ private function verifyAccess($response = 200) { $this->assertText(t('Edit menu item'), 'Menu edit page was displayed'); } - // View menu settings page. - $this->drupalGet('admin/structure/menu/settings'); - $this->assertResponse($response); - if ($response == 200) { - $this->assertText(t('Menus'), 'Menu settings page was displayed'); - } - // View add menu page. $this->drupalGet('admin/structure/menu/add'); $this->assertResponse($response); diff --git a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6MenuSettings.php b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6MenuSettings.php index 752614a..a5ac43f 100644 --- a/core/modules/migrate_drupal/src/Tests/Dump/Drupal6MenuSettings.php +++ b/core/modules/migrate_drupal/src/Tests/Dump/Drupal6MenuSettings.php @@ -23,14 +23,6 @@ public function load() { 'value', )) ->values(array( - 'name' => 'menu_primary_links_source', - 'value' => 's:13:"primary-links";', - )) - ->values(array( - 'name' => 'menu_secondary_links_source', - 'value' => 's:15:"secondary-links";', - )) - ->values(array( 'name' => 'menu_override_parent_selector', 'value' => 'b:0;', )) diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php index aa4fd0c..cc8a89d 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php @@ -46,8 +46,6 @@ protected function setUp() { */ public function testMenuSettings() { $config = \Drupal::config('menu_ui.settings'); - $this->assertIdentical($config->get('main_links'), 'primary-links'); - $this->assertIdentical($config->get('secondary_links'), 'secondary-links'); $this->assertIdentical($config->get('override_parent_selector'), FALSE); $this->assertConfigSchema(\Drupal::service('config.typed'), 'menu_ui.settings', $config->get()); } diff --git a/core/modules/system/config/install/system.theme.global.yml b/core/modules/system/config/install/system.theme.global.yml index 13036bf..5ee6cc7 100644 --- a/core/modules/system/config/install/system.theme.global.yml +++ b/core/modules/system/config/install/system.theme.global.yml @@ -10,8 +10,6 @@ features: logo: true name: true node_user_picture: true - main_menu: true - secondary_menu: true slogan: true logo: path: '' diff --git a/core/modules/system/src/Form/ThemeSettingsForm.php b/core/modules/system/src/Form/ThemeSettingsForm.php index 383f7ac..054f44b 100644 --- a/core/modules/system/src/Form/ThemeSettingsForm.php +++ b/core/modules/system/src/Form/ThemeSettingsForm.php @@ -106,8 +106,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $theme = 'comment_user_picture' => t('User pictures in comments'), 'comment_user_verification' => t('User verification status in comments'), 'favicon' => t('Shortcut icon'), - 'main_menu' => t('Main menu'), - 'secondary_menu' => t('Secondary menu'), ); // Some features are not always available diff --git a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php index 9c41eb8..cc91286 100644 --- a/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php @@ -77,7 +77,11 @@ function testPageCacheTags() { 'block:bartik_login', 'block:bartik_footer', 'block:bartik_powered', + 'block:bartik_main_menu', + 'block:bartik_account_menu', 'block_plugin:system_main_block', + 'block_plugin:system_menu_block__account', + 'block_plugin:system_menu_block__main', 'block_plugin:system_menu_block__tools', 'block_plugin:user_login_block', 'block_plugin:system_menu_block__footer', @@ -86,6 +90,7 @@ function testPageCacheTags() { 'node:' . $node_1->id(), 'user:' . $author_1->id(), 'filter_format:basic_html', + 'menu:account', 'menu:tools', 'menu:footer', 'menu:main', @@ -103,7 +108,11 @@ function testPageCacheTags() { 'block:' . $block->id(), 'block:bartik_footer', 'block:bartik_powered', + 'block:bartik_main_menu', + 'block:bartik_account_menu', 'block_plugin:system_main_block', + 'block_plugin:system_menu_block__account', + 'block_plugin:system_menu_block__main', 'block_plugin:system_menu_block__tools', 'block_plugin:user_login_block', 'block_plugin:views_block__comments_recent-block_1', @@ -113,6 +122,7 @@ function testPageCacheTags() { 'node:' . $node_2->id(), 'user:' . $author_2->id(), 'filter_format:full_html', + 'menu:account', 'menu:tools', 'menu:footer', 'menu:main', diff --git a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php index ea55662..cf5ab1a 100644 --- a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php @@ -278,7 +278,7 @@ function testBreadCrumbs() { // untranslated menu links automatically generated from menu router items // ('taxonomy/term/%') should never be translated and appear in any menu // other than the breadcrumb trail. - $elements = $this->xpath('//div[@id=:menu]/descendant::a[@href=:href]', array( + $elements = $this->xpath('//nav[@id=:menu]/descendant::a[@href=:href]', array( ':menu' => 'block-bartik-tools', ':href' => url($link_path), )); diff --git a/core/modules/system/src/Tests/System/PageTitleTest.php b/core/modules/system/src/Tests/System/PageTitleTest.php index 6b2d249..4516a57 100644 --- a/core/modules/system/src/Tests/System/PageTitleTest.php +++ b/core/modules/system/src/Tests/System/PageTitleTest.php @@ -75,8 +75,6 @@ function testTitleXSS() { $edit = array( 'toggle_name' => TRUE, 'toggle_slogan' => TRUE, - 'toggle_main_menu' => TRUE, - 'toggle_secondary_menu' => TRUE, ); $this->drupalPostForm('admin/appearance/settings', $edit, t('Save configuration')); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 54deb65..2557104 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -154,13 +154,18 @@ function system_help($route_name, RouteMatchInterface $route_match) { function system_theme() { return array_merge(drupal_common_theme(), array( // Normally theme suggestion templates are only picked up when they are in - // themes. We explicitly define the block__system_branding_block theme - // suggestion here so that the template in core/modules/system/templates - // is picked up. + // themes. We explicitly define theme suggestions here so that the block + // templates in core/modules/system/templates are picked up. 'block__system_branding_block' => array( + 'render element' => 'elements', 'base hook' => 'block', 'template' => 'block--system-branding-block', ), + 'block__system_menu_block' => array( + 'render element' => 'elements', + 'base hook' => 'block', + 'template' => 'block--system-menu-block', + ), 'system_themes_page' => array( 'variables' => array( 'theme_groups' => array(), @@ -671,14 +676,6 @@ function system_preprocess_block(&$variables) { case 'system_help_block': $variables['attributes']['role'] = 'complementary'; break; - - case 'system_menu_block': - $menus = menu_list_system_menus(); - if (isset($menus[$variables['derivative_plugin_id']])) { - $variables['attributes']['role'] = 'navigation'; - $variables['attributes']['class'][] = 'block-menu'; - } - break; } } @@ -926,8 +923,6 @@ function _system_default_theme_features() { 'node_user_picture', 'comment_user_picture', 'comment_user_verification', - 'main_menu', - 'secondary_menu', ); } diff --git a/core/modules/system/templates/block--system-menu-block.html.twig b/core/modules/system/templates/block--system-menu-block.html.twig new file mode 100644 index 0000000..27bb73e --- /dev/null +++ b/core/modules/system/templates/block--system-menu-block.html.twig @@ -0,0 +1,72 @@ +{# +/** + * @file + * Default theme implementation for a menu block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - module: The module that provided this block plugin. + * - cache: The cache settings. + * - Block plugin specific settings will also be stored here. + * - block - The full block entity. + * - label_hidden: The hidden block title value if the block was + * configured to hide the title ('label' is empty in this case). + * - module: The module that generated the block. + * - delta: An ID for the block, unique within each module. + * - region: The block region embedding the current block. + * - content: The content of this block. + * - attributes: HTML attributes for the containing element. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: HTML attributes for the title element. + * - content_attributes: HTML attributes for the content element. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * Headings should be used on navigation menus that consistently appear on + * multiple pages. When this menu block's label is configured to not be + * displayed, it is automatically made invisible using the 'visually-hidden' CSS + * class, which still keeps it visible for screen-readers and assistive + * technology. Headings allow screen-reader and keyboard only users to navigate + * to or skip the links. + * See http://juicystudio.com/article/screen-readers-display-none.php and + * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. + * + * @ingroup themeable + */ + @todo Remove the div around content as per http://drupal.org/node/1972122. +#} +{% + set classes = [ + 'block', + 'block-menu', + 'navigation', + 'menu--' ~ derivative_plugin_id|clean_class, + ] +%} +{% set heading_id = attributes.id ~ '-menu'|clean_id %} + + {# Label. If not displayed, we still provide it for screen readers. #} + {% if not configuration.label_display %} + {% set title_attributes = title_attributes.addClass('visually-hidden') %} + {% endif %} + {{ title_prefix }} +

{{ configuration.label }}

+ {{ title_suffix }} + + {# Menu. If no label is displayed, don't wrap it in
. #} + {% if configuration.label_display %} + + {% endif %} + {% block content %} + {{ content }} + {% endblock %} + {% if configuration.label_display %} +
+ {% endif %} + diff --git a/core/modules/system/templates/menu-tree.html.twig b/core/modules/system/templates/menu-tree.html.twig index 03acca6..82a3d01 100644 --- a/core/modules/system/templates/menu-tree.html.twig +++ b/core/modules/system/templates/menu-tree.html.twig @@ -6,20 +6,6 @@ * Available variables: * - attributes: Attributes for the UL containing the tree of links. * - tree: Menu tree to be output. - * - heading: (optional) A heading to precede the links. - * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). - * - attributes: (optional) A keyed list of attributes for the heading. - * If the heading is a string, it will be used as the text of the heading and - * the level will default to 'h2'. - * - * Headings should be used on navigation menus and any list of links that - * consistently appears on multiple pages. To make the heading invisible use - * the 'visually-hidden' CSS class. Do not use 'display:none', which - * removes it from screen-readers and assistive technology. Headings allow - * screen-reader and keyboard only users to navigate to or skip the links. - * See http://juicystudio.com/article/screen-readers-display-none.php and - * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. * * @see template_preprocess_menu_tree() * @@ -27,14 +13,7 @@ */ #} {% if tree -%} - {%- if heading -%} - {%- if heading.level -%} - <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} - {%- else -%} - {{ heading.text }} - {%- endif -%} - {%- endif -%} - + {{ tree }} {%- endif %} diff --git a/core/modules/system/templates/page.html.twig b/core/modules/system/templates/page.html.twig index ba013a2..41d8270 100644 --- a/core/modules/system/templates/page.html.twig +++ b/core/modules/system/templates/page.html.twig @@ -26,9 +26,6 @@ * slogan has been disabled in theme settings. * * Navigation: - * - main_menu: The Main menu links for the site, if they have been configured. - * - secondary_menu: The Secondary menu links for the site, if they have been - * configured. * - breadcrumb: The breadcrumb trail for the current page. * * Page content (in order of occurrence in the default page.html.twig): @@ -50,6 +47,8 @@ * * Regions: * - page.header: Items for the header region. + * - page.primary_menu: Items for the primary menu region. + * - page.secondary_menu: Items for the secondary menu region. * - page.highlighted: Items for the highlighted content region. * - page.help: Dynamic help text, mostly for admin pages. * - page.content: The main content of the current page. @@ -90,17 +89,13 @@
{{ site_slogan }}
{% endif %} {# ./name-and-slogan #} - {% endif %} + {% endif %} {{ page.header }} - {% if main_menu or secondary_menu %} - - {% endif %} + {{ page.primary_menu }} + {{ page.secondary_menu }} {{ breadcrumb }} diff --git a/core/modules/user/src/Tests/UserAccountLinksTests.php b/core/modules/user/src/Tests/UserAccountLinksTests.php index 4ad246b..97fa8a3 100644 --- a/core/modules/user/src/Tests/UserAccountLinksTests.php +++ b/core/modules/user/src/Tests/UserAccountLinksTests.php @@ -24,8 +24,12 @@ class UserAccountLinksTests extends WebTestBase { */ public static $modules = array('menu_ui', 'block', 'test_page_test'); + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_menu_block:account'); // Make test-page default. \Drupal::config('system.site')->set('page.front', 'test-page')->save(); } diff --git a/core/modules/user/src/Tests/UserPasswordResetTest.php b/core/modules/user/src/Tests/UserPasswordResetTest.php index 0ea06c0..2e61de5 100644 --- a/core/modules/user/src/Tests/UserPasswordResetTest.php +++ b/core/modules/user/src/Tests/UserPasswordResetTest.php @@ -22,9 +22,21 @@ class UserPasswordResetTest extends WebTestBase { */ protected $account; + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['block']; + + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); + $this->drupalPlaceBlock('system_menu_block:account'); + // Create a user. $account = $this->drupalCreateUser(); diff --git a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php index 3750601..d975a80 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php @@ -108,7 +108,7 @@ public function testPageDisplayMenu() { $this->drupalPlaceBlock('system_menu_block:tools'); $this->drupalGet(''); - $menu_link = $this->cssSelect('div.block-menu ul.menu a'); + $menu_link = $this->cssSelect('nav.block-menu ul.menu a'); $this->assertEqual((string) $menu_link[0], 'Test menu link'); // Update the menu link. @@ -117,7 +117,7 @@ public function testPageDisplayMenu() { ], t('Save')); $this->drupalGet(''); - $menu_link = $this->cssSelect('div.block-menu ul.menu a'); + $menu_link = $this->cssSelect('nav.block-menu ul.menu a'); $this->assertEqual((string) $menu_link[0], 'New title'); } diff --git a/core/modules/views/src/Tests/Wizard/MenuTest.php b/core/modules/views/src/Tests/Wizard/MenuTest.php index 505b4ce..ba3aa42 100644 --- a/core/modules/views/src/Tests/Wizard/MenuTest.php +++ b/core/modules/views/src/Tests/Wizard/MenuTest.php @@ -20,6 +20,8 @@ class MenuTest extends WizardTestBase { * Tests the menu functionality. */ function testMenus() { + $this->drupalPlaceBlock('system_menu_block:main'); + // Create a view with a page display and a menu link in the Main Menu. $view = array(); $view['label'] = $this->randomMachineName(16); diff --git a/core/profiles/standard/config/install/block.block.bartik_account_menu.yml b/core/profiles/standard/config/install/block.block.bartik_account_menu.yml new file mode 100644 index 0000000..beded3f --- /dev/null +++ b/core/profiles/standard/config/install/block.block.bartik_account_menu.yml @@ -0,0 +1,25 @@ +id: bartik_account_menu +theme: bartik +weight: 0 +status: true +langcode: en +region: secondary_menu +plugin: 'system_menu_block:account' +settings: + visibility: { } + id: 'system_menu_block:account' + label: 'User account menu (level 1)' + provider: system + label_display: '0' + cache: + max_age: -1 + contexts: { } + level: 1 + depth: 1 +dependencies: + entity: + - system.menu.account + module: + - system + theme: + - bartik diff --git a/core/profiles/standard/config/install/block.block.bartik_main_menu.yml b/core/profiles/standard/config/install/block.block.bartik_main_menu.yml new file mode 100644 index 0000000..90a596f --- /dev/null +++ b/core/profiles/standard/config/install/block.block.bartik_main_menu.yml @@ -0,0 +1,25 @@ +id: bartik_main_menu +theme: bartik +weight: 0 +status: true +langcode: en +region: primary_menu +plugin: 'system_menu_block:main' +settings: + visibility: {} + id: 'system_menu_block:main' + label: 'Main navigation' + provider: system + label_display: '0' + cache: + max_age: -1 + contexts: { } + level: 1 + depth: 1 +dependencies: + entity: + - system.menu.main + module: + - system + theme: + - bartik diff --git a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php index 4e337e4..cd1a392 100644 --- a/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php +++ b/core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php @@ -227,65 +227,6 @@ public function testFlatten() { } /** - * Tests the extractSubtreeOfActiveTrail() tree manipulator. - * - * @covers ::extractSubtreeOfActiveTrail - */ - public function testExtractSubtreeOfActiveTrail() { - // No link in the active trail. - $this->mockTree(); - // Get level 0. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 0); - $this->assertEquals(array(1, 2, 5, 6, 8), array_keys($tree)); - // Get level 1. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 1); - $this->assertEquals(array(), array_keys($tree)); - // Get level 2. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 1); - $this->assertEquals(array(), array_keys($tree)); - - // Link 5 in the active trail. - $this->mockTree(); - $this->originalTree[5]->inActiveTrail = TRUE; - // Get level 0. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 0); - $this->assertEquals(array(1, 2, 5, 6, 8), array_keys($tree)); - // Get level 1. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 1); - $this->assertEquals(array(7), array_keys($tree)); - // Get level 2. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 2); - $this->assertEquals(array(), array_keys($tree)); - - // Link 2 in the active trail. - $this->mockTree(); - $this->originalTree[2]->inActiveTrail = TRUE; - // Get level 0. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 0); - $this->assertEquals(array(1, 2, 5, 6, 8), array_keys($tree)); - // Get level 1. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 1); - $this->assertEquals(array(3), array_keys($tree)); - // Get level 2. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 2); - $this->assertEquals(array(), array_keys($tree)); - - // Links 2 and 3 in the active trail. - $this->mockTree(); - $this->originalTree[2]->inActiveTrail = TRUE; - $this->originalTree[2]->subtree[3]->inActiveTrail = TRUE; - // Get level 0. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 0); - $this->assertEquals(array(1, 2, 5, 6, 8), array_keys($tree)); - // Get level 1. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 1); - $this->assertEquals(array(3), array_keys($tree)); - // Get level 2. - $tree = $this->defaultMenuTreeManipulators->extractSubtreeOfActiveTrail($this->originalTree, 2); - $this->assertEquals(array(4), array_keys($tree)); - } - - /** * Tests the optimized node access checking. * * @covers ::checkNodeAccess diff --git a/core/themes/bartik/bartik.info.yml b/core/themes/bartik/bartik.info.yml index 22b8a8d..48e1715 100644 --- a/core/themes/bartik/bartik.info.yml +++ b/core/themes/bartik/bartik.info.yml @@ -10,6 +10,8 @@ ckeditor_stylesheets: - css/ckeditor-iframe.css regions: header: Header + primary_menu: 'Primary menu' + secondary_menu: 'Secondary menu' help: Help page_top: 'Page top' page_bottom: 'Page bottom' diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 27f8973..c402cf9 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -55,17 +55,6 @@ function bartik_preprocess_page(&$variables) { // Store back the classes to the htmlpage object. $attributes['class'] = $classes; - // Set additional attributes on the primary and secondary navigation menus. - if (!empty($variables['main_menu'])) { - $variables['main_menu']['#attributes']['id'] = 'main-menu-links'; - $variables['main_menu']['#attributes']['class'][] = 'links'; - } - if (!empty($variables['secondary_menu'])) { - $variables['secondary_menu']['#attributes']['id'] = 'secondary-menu-links'; - $variables['secondary_menu']['#attributes']['class'][] = 'links'; - $variables['secondary_menu']['#attributes']['class'][] = 'inline'; - } - // Set the options that apply to both page and maintenance page. _bartik_process_page($variables); diff --git a/core/themes/bartik/css/colors.css b/core/themes/bartik/css/colors.css index b52e01e..5e73a26 100644 --- a/core/themes/bartik/css/colors.css +++ b/core/themes/bartik/css/colors.css @@ -8,8 +8,8 @@ body { } #page, #main-wrapper, -#main-menu-links li a.active, -#main-menu-links li.active-trail a { +.menu--primary li a.active, +.menu--primary li.active-trail a { background: #ffffff; } .tabs ul.primary li a.active { @@ -53,6 +53,6 @@ a:active, .site-branding-block, #name-and-slogan a, .site-branding-block a, -#secondary-menu-links li a { +.menu--secondary li a { color: #fffeff; } diff --git a/core/themes/bartik/css/layout.css b/core/themes/bartik/css/layout.css index 7374a10..06c9433 100644 --- a/core/themes/bartik/css/layout.css +++ b/core/themes/bartik/css/layout.css @@ -24,15 +24,15 @@ body, #header div.section { position: relative; } -.region-header { +.menu--secondary { float: right; /* LTR */ margin: .5em 5px .75em; border: 1px solid #ccc; } -[dir="rtl"] .region-header { +[dir="rtl"] .menu--secondary { float: left; } -#secondary-menu { +.menu--secondary .block-menu { width: 100%; margin: 0 auto; overflow: hidden; diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css index 6470a33..9846895 100644 --- a/core/themes/bartik/css/style.css +++ b/core/themes/bartik/css/style.css @@ -420,6 +420,7 @@ h1.site-name { list-style-image: none; padding: 0; } + .region-header .form-text { background: #fefefe; background: rgba(255, 255, 255, 0.7); @@ -441,30 +442,7 @@ h1.site-name { .region-header .form-required:after { background-image: url(../images/required.svg); } -/* Region header block menus. */ -.region-header .block-menu { - border: 1px solid; - border-color: #eee; - border-color: rgba(255, 255, 255, 0.2); - padding: 0; - width: 208px; -} -.region-header .block-menu li a { - display: block; - border-bottom: 1px solid; - border-bottom-color: #eee; - border-bottom-color: rgba(255, 255, 255, 0.2); - padding: 3px 7px; -} -.region-header .block-menu li a:hover, -.region-header .block-menu li a:active, -.region-header .block-menu li a:focus { - text-decoration: none; - background: rgba(255, 255, 255, 0.15); -} -.region-header .block-menu li:last-child a { - border-bottom: 0; -} + /* User Login block in the header region */ .region-header #block-user-login { width: auto; @@ -546,20 +524,30 @@ h1.site-name { float: right; } -/* --------------- Main Menu ------------ */ -#main-menu { +/* --------------- Menu Regions ------------ */ + +/* Treat menu blocks in the menu regions as a special case. */ +.menu--primary .block-menu, +.menu--secondary .block-menu { + float: none; + margin: 0; + font-size: inherit; +} + +/* --------------- Primary Menu ------------ */ +.menu--primary { clear: both; } -#main-menu-links { +.menu--primary .block-menu { font-size: 0.929em; margin: 0 5px; padding: 0; text-align: left; /* LTR */ } -[dir="rtl"] #main-menu-links { +[dir="rtl"] .menu--primary .block-menu{ text-align: right; } -#main-menu-links li { +.menu--primary .block-menu li { float: none; list-style: none; margin: 0; @@ -567,7 +555,7 @@ h1.site-name { height: auto; width: 100%; } -#main-menu-links a { +.menu--primary .block-menu a { color: #333; background: #ccc; background: rgba(255, 255, 255, 0.7); @@ -579,31 +567,37 @@ h1.site-name { margin: 4px 0; padding: 0.9em 0 0.9em 10px; /* LTR */ } -[dir="rtl"] #main-menu-links a { +[dir="rtl"] .menu--primary .block-menu a { padding: 0.9em 10px 0.9em 0; } -#main-menu-links a:hover, -#main-menu-links a:focus { +.menu--primary .block-menu a:hover, +.menu--primary .block-menu a:focus { background: #f6f6f2; background: rgba(255, 255, 255, 0.95); } -#main-menu-links a:active { +.menu--primary .block-menu a:active { background: #b3b3b3; background: rgba(255, 255, 255, 1); } -#main-menu-links li a.active { +.menu--primary .block-menu li a.active { border-bottom: none; } -/* ---------- Main Menu Toggle ----------- */ -#nav, #no-nav { +/* ---------- Primary Menu Toggle ----------- */ +/* Hide the toggle by default. */ +.menu-toggle { + display: none; +} +/* Unhide it for the primary menu. */ +.menu--primary .menu-toggle-target { + display: inherit; position: fixed; top: 0; } -.main-menu-reveal { +.menu--primary .menu-toggle { display: none; } -body:not(:target) .main-menu-reveal { +body:not(:target) .menu--primary .menu-toggle { color: #333; background: #ccc; background: rgba(255, 255, 255, 0.7); @@ -615,7 +609,7 @@ body:not(:target) .main-menu-reveal { padding: 0.9em 10px 0.9em 10px; z-index: 1000; } -body:not(:target) .main-menu-reveal:after { +body:not(:target) .menu--primary .menu-toggle:after { content:""; background: url(../../../misc/icons/ffffff/hamburger.svg) no-repeat; background-size: contain; @@ -625,21 +619,18 @@ body:not(:target) .main-menu-reveal:after { position: absolute; right: 10px; /* LTR */ } -body:not(:target) #nav:target ~ .main-menu-reveal, -body:not(:target) .main-menu-reveal--hide { +body:not(:target) .menu--primary .menu-toggle-target-show:target ~ .menu-toggle, +body:not(:target) .menu--primary .menu-toggle--hide { display: none; } -body:not(:target) #nav:target ~ .main-menu-reveal--hide { +body:not(:target) .menu--primary .menu-toggle-target-show:target ~ .menu-toggle--hide { display: block; } -[dir="rtl"] #secondary-menu-links { - left: 10px; - right: auto; -} -#main-menu-links .menu-hide a { + +.menu--primary .block-menu .menu-hide a { display: none; } -body:not(:target) #nav:target ~ #main-menu-links .menu-hide a { +body:not(:target) .menu--primary .menu-toggle-target-show:target ~ .menu .menu-hide a { background-color: transparent; border: none; display: block; @@ -652,35 +643,39 @@ body:not(:target) #nav:target ~ #main-menu-links .menu-hide a { text-indent: -999em; z-index: 1001; } -body:not(:target) #main-menu-links li { +body:not(:target) .menu--primary .block-menu li { height: 0; overflow: hidden; } -body:not(:target) #nav:target ~ #main-menu-links li { +body:not(:target) .menu--primary .menu-toggle-target-show:target ~ .menu li { height: auto; overflow: visible; } /* --------------- Secondary Menu ------------ */ -#secondary-menu-links { +.menu--secondary .block-menu { float: right; /* LTR */ font-size: 0.929em; margin: 0 10px; } -[dir="rtl"] #secondary-menu-links { - float: left; + +[dir="rtl"] .menu--secondary .block-menu { + float: left; + left: 10px; + right: auto; } -#secondary-menu-links li{ + +.menu--secondary .block-menu li{ margin: 0; padding: 0; } -#secondary-menu-links a { +.menu--secondary .block-menu a { display: inline-block; padding: 0.8em; } -#secondary-menu-links a:hover, -#secondary-menu-links a:focus { +.menu--secondary .block-menu a:hover, +.menu--secondary .block-menu a:focus { text-decoration: underline; } @@ -1874,8 +1869,8 @@ div.admin-panel .description { @media all and (min-width: 461px) and (max-width: 900px) { /* ------------ Header and Menus -------------------------- */ - .region-header { - margin: .5em 5px .75em; + .region-header { + margin: 0 5px 0; } #logo, .site-logo { @@ -1889,13 +1884,13 @@ div.admin-panel .description { .site-branding-text { padding: 10px 10px 8px; } - #main-menu-links { + .menu--primary .block-menu { margin: 0 5px; padding: 0; text-align: center; } - #main-menu-links li, - body:not(:target) #main-menu-links li { + .menu--primary .block-menu li, + body:not(:target) .menu--primary .block-menu li { float: left; /* LTR */ margin-right: 5px; /* LTR */ padding: 0; @@ -1904,26 +1899,26 @@ div.admin-panel .description { height: auto; overflow: visible; } - [dir="rtl"] #main-menu-links li { + [dir="rtl"] .menu--primary .block-menu li { float: right; margin-left: 5px; margin-right: 0; } - #main-menu-links li:nth-child(3n) { + .menu--primary .block-menu li:nth-child(3n) { margin-right: -5px; /* LTR */ } - [dir="rtl"] #main-menu-links li:nth-child(3n) { + [dir="rtl"] .menu--primary .block-menu li:nth-child(3n) { margin-left: -5px; margin-right: 0; } - #main-menu-links a { + .menu--primary .block-menu a { float: none; display: block; border-radius: 8px; margin-bottom: 5px; padding: 0.9em 5px; } - body:not(:target) .main-menu-reveal { + body:not(:target) .menu--primary .menu-toggle { display: none; } } @@ -1931,7 +1926,7 @@ div.admin-panel .description { @media all and (min-width: 901px) { .region-header { - margin: 1em 5px 1.5em; + margin: 0 5px 0; } #logo, .site-logo { @@ -1954,13 +1949,13 @@ div.admin-panel .description { .site-name { font-size: 1.821em; } - #main-menu-links { + .menu--primary .block-menu { font-size: 0.929em; margin: 0; padding: 0 15px; } - #main-menu-links li, - body:not(:target) #main-menu-links li { + .menu--primary .block-menus li, + body:not(:target) .menu--primary .block-menu li { float: left; /* LTR */ list-style: none; padding: 0 1px; @@ -1969,26 +1964,26 @@ div.admin-panel .description { height: auto; overflow: visible; } - [dir="rtl"] #main-menu-links li { + [dir="rtl"] .menu--primary .block-menu li { float: right; } - #main-menu-links a { + .menu--primary .block-menu a { float: left; /* LTR */ padding: 0.7em 0.8em; margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; } - [dir="rtl"] #main-menu-links a { + [dir="rtl"] .menu--primary .block-menu a { float: right; padding: 0.7em 0.8em; } - .featured #main-menu-links li a:active, - .featured #main-menu-links li a.active { + .featured .menu--primary .block-menu li a:active, + .featured .menu--primary .block-menu li a.active { background: #f0f0f0; background: rgba(240, 240, 240, 1.0); } - body:not(:target) .main-menu-reveal { + body:not(:target) .menu--primary .menu-toggle { display: none; } } diff --git a/core/themes/bartik/templates/block--system-menu-block.html.twig b/core/themes/bartik/templates/block--system-menu-block.html.twig new file mode 100644 index 0000000..87330f0 --- /dev/null +++ b/core/themes/bartik/templates/block--system-menu-block.html.twig @@ -0,0 +1,21 @@ +{% extends "@system/block--system-menu-block.html.twig" %} +{# +/** + * @file + * Bartik's theme implementation for a menu block. + * + * @ingroup themeable + */ +#} +{% set show_anchor = "show-" ~ attributes.id|clean_id %} +{% set hide_anchor = "hide-" ~ attributes.id|clean_id %} +{% block content %} + {# When rendering a menu without label, render a menu toggle. #} + {% if not configuration.label_display %} + + + {{ 'Menu'|t }} + {{ 'Menu'|t }} + {% endif %} + {{ content }} +{% endblock %} \ No newline at end of file diff --git a/core/themes/bartik/templates/page.html.twig b/core/themes/bartik/templates/page.html.twig index 2456642..a74283b 100644 --- a/core/themes/bartik/templates/page.html.twig +++ b/core/themes/bartik/templates/page.html.twig @@ -33,9 +33,6 @@ * added to make the site slogan visually hidden, but still accessible. * * Navigation: - * - main_menu: The Main menu links for the site, if they have been configured. - * - secondary_menu: The Secondary menu links for the site, if they have been - * configured. * - breadcrumb: The breadcrumb trail for the current page. * * Page content (in order of occurrence in the default page.html.twig): @@ -57,6 +54,8 @@ * * Regions: * - page.header: Items for the header region. + * - page.primary_menu: Items for the primary menu region. + * - page.secondary_menu: Items for the secondary menu region. * - page.featured: Items for the featured region. * - page.highlighted: Items for the highlighted content region. * - page.help: Dynamic help text, mostly for admin pages. @@ -79,11 +78,12 @@ #}
-