diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 1b1a52a..3cce004 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2404,9 +2404,9 @@ function menu_link_get_preferred($path = NULL, $selected_menu = NULL) { foreach ($menu_names as $menu_name) { if (empty($preferred_links[$path][$menu_name]) && isset($candidates[$link_path][$menu_name])) { $candidate_item = $candidates[$link_path][$menu_name]; - //$map = explode('/', $path); - //_menu_translate($candidate_item, $map); - if (TRUE || $candidate_item['access']) { + $map = explode('/', $path); + _menu_translate($candidate_item, $map); + if ($candidate_item['access']) { $preferred_links[$path][$menu_name] = $candidate_item; if (empty($preferred_links[$path][MENU_PREFERRED_LINK])) { // Store the most specific link. diff --git a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php index eb0e641..523ef0f 100644 --- a/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php +++ b/core/modules/entity/lib/Drupal/entity/Controller/EntityDisplayModeController.php @@ -54,7 +54,7 @@ public function viewModeTypeSelection() { if ($entity_info['fieldable'] && isset($entity_info['controllers']['view_builder'])) { $entity_types[$entity_type] = array( 'title' => $entity_info['label'], - 'href' => 'admin/structure/display-modes/view/add/' . $entity_type, + 'link_path' => 'admin/structure/display-modes/view/add/' . $entity_type, 'localized_options' => array(), ); } @@ -77,7 +77,7 @@ public function formModeTypeSelection() { if ($entity_info['fieldable'] && isset($entity_info['controllers']['form'])) { $entity_types[$entity_type] = array( 'title' => $entity_info['label'], - 'href' => 'admin/structure/display-modes/form/add/' . $entity_type, + 'link_path' => 'admin/structure/display-modes/form/add/' . $entity_type, 'localized_options' => array(), ); } diff --git a/core/modules/system/lib/Drupal/system/SystemManager.php b/core/modules/system/lib/Drupal/system/SystemManager.php index 9d5e910..1fa6246 100644 --- a/core/modules/system/lib/Drupal/system/SystemManager.php +++ b/core/modules/system/lib/Drupal/system/SystemManager.php @@ -209,17 +209,16 @@ public function getAdminBlock($item) { foreach ($menu_links as $link) { _menu_link_translate($link); if ($link['access']) { - // Prepare for sorting as in function _menu_tree_check_access(). - // The weight is offset so it is always positive, with a uniform 5-digits. - $key = (50000 + $link['weight']) . ' ' . Unicode::strtolower($link['title']) . ' ' . $link['mlid']; - $content[$key] = $link->build(); // The link description, either derived from 'description' in // hook_menu() or customized via menu module is used as title attribute. - // @todo - make description a separate entity property. - if (!empty($content[$key]['#options']['attributes']['title'])) { - $content[$key]['#description'] = $content[$key]['#options']['attributes']['title']; - unset($content[$key]['#options']['attributes']['title']); + if (!empty($link['localized_options']['attributes']['title'])) { + $link['description'] = $link['localized_options']['attributes']['title']; + unset($link['localized_options']['attributes']['title']); } + // Prepare for sorting as in function _menu_tree_check_access(). + // The weight is offset so it is always positive, with a uniform 5-digits. + $key = (50000 + $link['weight']) . ' ' . Unicode::strtolower($link['title']) . ' ' . $link['mlid']; + $content[$key] = $link; } } ksort($content); diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php index 91f63d9..ab55143 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php @@ -302,7 +302,6 @@ protected function doTestMenuGetItemNoAncestors() { */ protected function doTestMenuSetItem() { $item = menu_get_item('test-page'); - debug($item); $this->assertEqual($item['path'], 'test-page', "Path from menu_get_item('test-page') is equal to 'test-page'", 'menu'); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index a70d10d..0fce7e4 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -345,9 +345,9 @@ function theme_admin_block_content($variables) { } $output .= '
'; foreach ($content as $item) { - $output .= '
' . drupal_render($item) . '
'; - if (!$compact && isset($item['#description'])) { - $output .= '
' . filter_xss_admin($item['#description']) . '
'; + $output .= '
' . l($item['title'], $item['link_path'], $item['localized_options']) . '
'; + if (!$compact && isset($item['description'])) { + $output .= '
' . filter_xss_admin($item['description']) . '
'; } } $output .= '
'; diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index c1a7a37..1bb4abc 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -286,6 +286,7 @@ system.admin_index: path: '/admin/index' defaults: _content: 'Drupal\system\Controller\AdminController::index' + _title: 'Administration' requirements: _permission: 'access administration pages' diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php index 24e7244..bbe5a71 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserAccountLinksTests.php @@ -129,11 +129,8 @@ function testAccountPageTitles() { // Check the page title for registered users is "My Account" in menus. $this->drupalLogin($this->drupalCreateUser()); // After login, the client is redirected to /user. - $link = $this->xpath('//a[contains(@class, :class)]', array( - ':class' => 'active-trail', - ) - ); - $this->assertEqual((string) $link[0], 'My account', "Page title of /user is 'My Account' in menus for registered users"); + $this->assertLink(t('My account'), 0, "Page title of /user is 'My Account' in menus for registered users"); + $this->assertLinkByHref(\Drupal::urlGenerator()->generate('user.page'), 0); } } diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 7defd49..dace91e 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -120,7 +120,7 @@ function seven_admin_block_content($variables) { if (isset($item['description']) && !system_admin_compact_mode()) { $content .= '
' . filter_xss_admin($item['description']) . '
'; } - $output .= l($content, $item['href'], $options); + $output .= l($content, $item['link_path'], $options); $output .= ''; } $output .= '';