diff --git a/core/core.services.yml b/core/core.services.yml index 098e715..5c00693 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -266,7 +266,10 @@ services: arguments: ['@menu.tree_storage', '@menu_link.static.overrides', '@module_handler'] menu.link_tree: class: Drupal\Core\Menu\MenuLinkTree - arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@request_stack', '@router.route_provider', '@cache.menu', '@access_manager', '@current_user', '@config.factory'] + arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@request_stack', '@router.route_provider', '@cache.menu', '@access_manager', '@current_user', '@menu.active_trail'] + menu.active_trail: + class: Drupal\Core\Menu\MenuActiveTrail + arguments: ['@plugin.manager.menu.link', '@request_stack', '@access_manager', '@current_user', '@config.factory'] menu.parent_form_selector: class: Drupal\Core\Menu\MenuParentFormSelector arguments: ['@menu.link_tree', '@entity.manager'] diff --git a/core/lib/Drupal/Core/Menu/MenuActiveTrail.php b/core/lib/Drupal/Core/Menu/MenuActiveTrail.php new file mode 100644 index 0000000..97c4f6f --- /dev/null +++ b/core/lib/Drupal/Core/Menu/MenuActiveTrail.php @@ -0,0 +1,206 @@ +menuLinkManager = $menu_link_manager; + $this->requestStack = $request_stack; + $this->accessManager = $access_manager; + $this->account = $account; + $this->configFactory = $config_factory; + } + + /** + * {@inheritdoc} + */ + public function getActiveTrailIds($menu_name) { + // Parent ids; used both as key and value to ensure uniqueness. + // We always want all the top-level links with parent == ''. + $active_trail = array('' => ''); + + $request = $this->requestStack->getCurrentRequest(); + + if ($route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME)) { + $route_parameters = $request->attributes->get('_raw_variables')->all(); + $page_is_403 = $request->attributes->get('_exception_statuscode') == 403; + // Find a menu link corresponding to the current path. If + // $active_path is NULL, let $this->menuLinkGetPreferred() determine the + // path. + if (!$page_is_403) { + $active_link = $this->menuLinkGetPreferred($route_name, $route_parameters, $menu_name); + if ($active_link && $active_link->getMenuName() == $menu_name) { + $active_trail += $this->menuLinkManager->getParentIds($active_link->getPluginId()); + } + } + } + return $active_trail; + } + + /** + * {@inheritdoc} + */ + public function menuLinkGetPreferred($route_name = NULL, array $route_parameters = array(), $selected_menu = NULL) { + if (!isset($route_name)) { + $request = $this->requestStack->getCurrentRequest(); + + $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME); + $route_parameters = $request->attributes->get('_raw_variables')->all(); + } + + $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account); + if (!$access) { + return NULL; + } + asort($route_parameters); + $route_key = $route_name . serialize($route_parameters); + + if (empty($selected_menu)) { + // Use an illegal menu name as the key for the preferred menu link. + $selected_menu = '%'; + } + + if (!isset($this->preferredLinks[$route_key])) { + // Retrieve a list of menu names, ordered by preference. + $menu_names = $this->getActiveMenuNames(); + // Put the selected menu at the front of the list. + array_unshift($menu_names, $selected_menu); + // If this menu name is not fond later, we want to just get NULL. + $this->preferredLinks[$route_key][$selected_menu] = NULL; + + // Only load non-hidden links. + $links = $this->menuLinkManager->loadLinksByRoute($route_name, $route_parameters); + // Sort candidates by menu name. + $candidates = array(); + foreach ($links as $candidate) { + $candidates[$candidate->getMenuName()] = $candidate; + $menu_names[] = $candidate->getMenuName(); + } + foreach ($menu_names as $menu_name) { + if (isset($candidates[$menu_name]) && !isset($this->preferredLinks[$route_key][$menu_name])) { + $instance = $candidates[$menu_name]; + $this->preferredLinks[$route_key][$menu_name] = $instance; + if (!isset($this->preferredLinks[$route_key]['%'])) { + $this->preferredLinks[$route_key]['%'] = $instance; + } + } + } + + } + return isset($this->preferredLinks[$route_key][$selected_menu]) ? $this->preferredLinks[$route_key][$selected_menu] : NULL; + } + + /** + * {@inheritdoc} + */ + public function getActiveMenuNames() { + return $this->activeMenus; + } + + /** + * {@inheritdoc} + */ + public function setActiveMenuNames(array $menu_names) { + + if (isset($menu_names) && is_array($menu_names)) { + $this->activeMenus = $menu_names; + } + elseif (!isset($this->activeMenus)) { + $config = $this->configFactory->get('system.menu'); + $this->activeMenus = $config->get('active_menus_default') ?: array_keys($this->listSystemMenus()); + } + } + + /** + * Returns an array containing the names of system-defined (default) menus. + */ + protected function listSystemMenus() { + // For simplicity and performance, this is simply a hard-coded list copied + // from menu_list_system_menus() which is simply the list of all Menu config + // entities that are shipped with system module. + return array( + 'tools' => 'Tools', + 'admin' => 'Administration', + 'account' => 'User account menu', + 'main' => 'Main navigation', + 'footer' => 'Footer menu', + ); + } + +} diff --git a/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php b/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php new file mode 100644 index 0000000..3222378 --- /dev/null +++ b/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php @@ -0,0 +1,64 @@ +treeStorage->loadByRoute($route_name, $route_parameters, $include_hidden); + $loaded = $this->treeStorage->loadByRoute($route_name, $route_parameters, $menu_name); foreach ($loaded as $plugin_id => $definition) { $instances[$plugin_id] = $this->createInstance($plugin_id); } diff --git a/core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php b/core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php index 4269cba..94e565d 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php @@ -50,14 +50,13 @@ public function deleteLink($id, $persist = TRUE); * The route name. * @param array $route_parameters * (optional) The route parameters, defaults to an empty array. - * @param bool $include_hidden - * (optional) Flag to specify whether hidden links should be returned too. - * Defaults to FALSE. + * @param string $menu_name + * (optional) Restricts the found links to just those in the named menu. * * @return \Drupal\Core\Menu\MenuLinkInterface[] * An array of instances keyed by ID. */ - public function loadLinksByRoute($route_name, array $route_parameters = array(), $include_hidden = FALSE); + public function loadLinksByRoute($route_name, array $route_parameters = array(), $menu_name = NULL); /** * Adds a new link to the tree storage. diff --git a/core/lib/Drupal/Core/Menu/MenuLinkTree.php b/core/lib/Drupal/Core/Menu/MenuLinkTree.php index 30942f2..c4e6d57 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkTree.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkTree.php @@ -7,13 +7,9 @@ namespace Drupal\Core\Menu; -use Drupal\Component\Utility\Unicode; use Drupal\Core\Access\AccessManager; use Drupal\Core\Cache\Cache; -use Drupal\Core\Menu\MenuLinkManagerInterface; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Routing\RouteProviderInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; @@ -129,11 +125,11 @@ class MenuLinkTree implements MenuLinkTreeInterface { protected $account; /** - * The configuration factory. + * The menu active trail service. * - * @var \Drupal\Core\Config\ConfigFactoryInterface + * @var \Drupal\Core\Menu\MenuActiveTrailInterface */ - protected $configFactory; + protected $menuActiveTrail; /** * Stores the menu tree used by the doBuildTree method, keyed by a cache ID. @@ -191,10 +187,10 @@ class MenuLinkTree implements MenuLinkTreeInterface { * The access manager. * @param \Drupal\Core\Session\AccountInterface $account * The current user. - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * Configuration factory. + * @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail + * Menu active trail service. */ - public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkManagerInterface $menu_link_manager, RequestStack $request_stack, RouteProviderInterface $route_provider, CacheBackendInterface $tree_cache_backend, AccessManager $access_manager, AccountInterface $account, ConfigFactoryInterface $config_factory) { + public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkManagerInterface $menu_link_manager, RequestStack $request_stack, RouteProviderInterface $route_provider, CacheBackendInterface $tree_cache_backend, AccessManager $access_manager, AccountInterface $account, MenuActiveTrailInterface $menu_active_trail) { $this->treeStorage = $tree_storage; $this->menuLinkManager = $menu_link_manager; $this->requestStack = $request_stack; @@ -202,7 +198,7 @@ public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkMana $this->accessManager = $access_manager; $this->account = $account; $this->treeCacheBackend = $tree_cache_backend; - $this->configFactory = $config_factory; + $this->menuActiveTrail = $menu_active_trail; } /** @@ -277,124 +273,6 @@ public function buildRenderTree($tree) { /** * {@inheritdoc} */ - public function getActiveTrailIds($menu_name) { - // Parent ids; used both as key and value to ensure uniqueness. - // We always want all the top-level links with parent == ''. - $active_trail = array('' => ''); - - $request = $this->requestStack->getCurrentRequest(); - - if ($route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME)) { - $route_parameters = $request->attributes->get('_raw_variables')->all(); - $page_is_403 = $request->attributes->get('_exception_statuscode') == 403; - // Find a menu link corresponding to the current path. If - // $active_path is NULL, let $this->menuLinkGetPreferred() determine the - // path. - if (!$page_is_403) { - $active_link = $this->menuLinkGetPreferred($route_name, $route_parameters, $menu_name); - if ($active_link && $active_link->getMenuName() == $menu_name) { - $active_trail += $this->treeStorage->getRootPathIds($active_link->getPluginId()); - } - } - } - return $active_trail; - } - - /** - * {@inheritdoc} - */ - public function menuLinkGetPreferred($route_name = NULL, array $route_parameters = array(), $selected_menu = NULL) { - if (!isset($route_name)) { - $request = $this->requestStack->getCurrentRequest(); - - $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME); - $route_parameters = $request->attributes->get('_raw_variables')->all(); - } - - $access = $this->accessManager->checkNamedRoute($route_name, $route_parameters, $this->account); - if (!$access) { - return NULL; - } - asort($route_parameters); - $route_key = $route_name . serialize($route_parameters); - - if (empty($selected_menu)) { - // Use an illegal menu name as the key for the preferred menu link. - $selected_menu = '%'; - } - - if (!isset($this->preferredLinks[$route_key])) { - // Retrieve a list of menu names, ordered by preference. - $menu_names = $this->getActiveMenuNames(); - // Put the selected menu at the front of the list. - array_unshift($menu_names, $selected_menu); - // If this menu name is not fond later, we want to just get NULL. - $this->preferredLinks[$route_key][$selected_menu] = NULL; - - // Only load non-hidden links. - $definitions = $this->treeStorage->loadByRoute($route_name, $route_parameters); - // Sort candidates by menu name. - $candidates = array(); - foreach ($definitions as $candidate) { - $candidates[$candidate['menu_name']] = $candidate; - $menu_names[] = $candidate['menu_name']; - } - foreach ($menu_names as $menu_name) { - if (isset($candidates[$menu_name]) && !isset($this->preferredLinks[$route_key][$menu_name])) { - $candidate = $candidates[$menu_name]; - $this->definitions[$candidate['id']] = $candidate; - $instance = $this->menuLinkManager->createInstance($candidate['id']); - $this->preferredLinks[$route_key][$menu_name] = $instance; - if (!isset($this->preferredLinks[$route_key]['%'])) { - $this->preferredLinks[$route_key]['%'] = $instance; - } - } - } - - } - return isset($this->preferredLinks[$route_key][$selected_menu]) ? $this->preferredLinks[$route_key][$selected_menu] : NULL; - } - - /** - * {@inheritdoc} - */ - public function getActiveMenuNames() { - return $this->activeMenus; - } - - /** - * {@inheritdoc} - */ - public function setActiveMenuNames(array $menu_names) { - - if (isset($menu_names) && is_array($menu_names)) { - $this->activeMenus = $menu_names; - } - elseif (!isset($this->activeMenus)) { - $config = $this->configFactory->get('system.menu'); - $this->activeMenus = $config->get('active_menus_default') ?: array_keys($this->listSystemMenus()); - } - } - - /** - * Returns an array containing the names of system-defined (default) menus. - */ - protected function listSystemMenus() { - // For simplicity and performance, this is simply a hard-coded list copied - // from menu_list_system_menus() which is simply the list of all Menu config - // entities that are shipped with system module. - return array( - 'tools' => 'Tools', - 'admin' => 'Administration', - 'account' => 'User account menu', - 'main' => 'Main navigation', - 'footer' => 'Footer menu', - ); - } - - /** - * {@inheritdoc} - */ public function buildPageData($menu_name, $max_depth = NULL) { // Load the request corresponding to the current page. @@ -460,7 +338,7 @@ protected function doBuildPageDataTreeParameters($menu_name, $max_depth, $page_i // If this page is accessible to the current user, build the tree // parameters accordingly. if (!$page_is_403) { - $active_trail = $this->getActiveTrailIds($menu_name); + $active_trail = $this->menuActiveTrail->getActiveTrailIds($menu_name); // Collect all the links set to be expanded, and then add all of // their children to the list as well. $parents = $this->treeStorage->getExpanded($menu_name, $active_trail); @@ -496,7 +374,7 @@ public function buildAllData($menu_name, $id = NULL, $max_depth = NULL) { if ($id != '%') { // The tree is for a single item, so we need to match the values in // of all the IDs on the path to root. - $tree_parameters['active_trail'] = $this->treeStorage->getRootPathIds($id); + $tree_parameters['active_trail'] = $this->menuLinkManager->getParentIds($id); $tree_parameters['expanded'] = $tree_parameters['active_trail']; // Include top-level links. $tree_parameters['expanded'][''] = ''; diff --git a/core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php b/core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php index 01dd634..0d7c435 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php @@ -49,42 +49,6 @@ public function getSubtreeHeight($id); public function buildRenderTree($tree); /** - * Gets the active trail IDs of the specified menu tree. - * - * @param string $menu_name - * The menu name of the requested tree. - * - * @return array - * An array containing the active trail: a list of plugin ids. - */ - public function getActiveTrailIds($menu_name); - - /** - * Gets the active menus for the current page. - * - * The active menu for the page determines the active trail. - * - * @return array - * An array of menu machine names, in order of preference. The - * 'system.menu:active_menus_default' config item may be used to set a menu - * order different from the default order, or to prevent a particular menu - * from being used at all in the active trail. - */ - public function getActiveMenuNames(); - - /** - * Sets the active menu for the current page. - * - * This overrides for the current page the preferred list of menus returned - * by getActiveMenuNames(). The active menu for the page determines the active - * trail. - * - * @param array $menu_names - * The menu names to use as active for the current page. - */ - public function setActiveMenuNames(array $menu_names); - - /** * Gets the data structure for a named menu tree, based on the current page. * * Only visible links (hidden == 0) are returned in the data. @@ -184,21 +148,6 @@ public function buildSubtree($id, $max_relative_depth = NULL); public function getChildLinks($id, $max_relative_depth = NULL); /** - * Fetches a menu link which matches the route name, parameters and menu name. - * - * @param string $route_name - * (optional) The route name, defaults to NULL. - * @param array $route_parameters - * (optional) the route parameters, defaults to an empty array. - * @param string|NULL $selected_menu - * (optional) The menu to use to find preferred links, defaults to NULL. - * - * @return \Drupal\Core\Menu\MenuLinkInterface - * The prepared menu link for the given route name, parameters and menu. - */ - public function menuLinkGetPreferred($route_name = NULL, array $route_parameters = array(), $selected_menu = NULL); - - /** * For test purposes, clear any static data caches. */ public function resetStaticCache(); diff --git a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php index 85025d8..d151032 100644 --- a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php @@ -601,7 +601,7 @@ public function loadByProperties(array $properties) { /** * {@inheritdoc} */ - public function loadByRoute($route_name, array $route_parameters = array(), $include_hidden = FALSE) { + public function loadByRoute($route_name, array $route_parameters = array(), $menu_name = NULL) { asort($route_parameters); // Since this will be urlencoded, it's safe to store and match against a // text field. @@ -611,8 +611,8 @@ public function loadByRoute($route_name, array $route_parameters = array(), $inc $query->fields($this->table, $this->definitionFields()); $query->condition('route_name', $route_name); $query->condition('route_param_key', $param_key); - if (!$include_hidden) { - $query->condition('hidden', 0); + if ($menu_name) { + $query->condition('menu_name', $menu_name); } $loaded = $this->safeExecuteSelect($query)->fetchAllAssoc('id', \PDO::FETCH_ASSOC); foreach ($loaded as $id => $link) { diff --git a/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php b/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php index c9472f6..f386fc9 100644 --- a/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php @@ -72,14 +72,13 @@ public function loadByProperties(array $properties); * The route name. * @param array $route_parameters * (optional) The route parameters, defaults to an empty array. - * @param bool $include_hidden - * (optional) Flag to specify whether hidden links should be returned too. - * Defaults to FALSE. + * @param string $menu_name + * (optional) Restricts the found links to just those in the named menu. * * @return array * An array of menu link definitions keyed by ID. */ - public function loadByRoute($route_name, array $route_parameters = array(), $include_hidden = FALSE); + public function loadByRoute($route_name, array $route_parameters = array(), $menu_name = NULL); /** * Saves a plugin definition to the storage. diff --git a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php index 01ccca8..c22cfaa 100644 --- a/core/modules/system/src/Plugin/Block/SystemMenuBlock.php +++ b/core/modules/system/src/Plugin/Block/SystemMenuBlock.php @@ -11,6 +11,7 @@ use Drupal\block\BlockBase; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Menu\MenuLinkTreeInterface; +use Drupal\Core\Menu\MenuActiveTrailInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -34,6 +35,13 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa protected $menuTree; /** + * The menu active trail service. + * + * @var \Drupal\Core\Menu\MenuActiveTrailInterface + */ + protected $menuActiveTrail; + + /** * Constructs a new SystemMenuBlock. * * @param array $configuration @@ -44,10 +52,13 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa * The plugin implementation definition. * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree * The menu tree. + * @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail + * Menu active trail service. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->menuTree = $menu_tree; + $this->menuActiveTrail = $menu_active_trail; } /** @@ -58,7 +69,8 @@ public static function create(ContainerInterface $container, array $configuratio $configuration, $plugin_id, $plugin_definition, - $container->get('menu.link_tree') + $container->get('menu.link_tree'), + $container->get('menu.active_trail') ); } @@ -92,7 +104,7 @@ public function defaultConfiguration() { public function getCacheKeys() { // Add a key for the active menu trail. $menu = $this->getDerivativeId(); - $active_trail = $this->menuTree->getActiveTrailIds($menu); + $active_trail = $this->menuActiveTrail->getActiveTrailIds($menu); $active_trail_key = 'trail.' . implode('|', $active_trail); return array_merge(parent::getCacheKeys(), array($active_trail_key)); } diff --git a/core/modules/system/src/SystemManager.php b/core/modules/system/src/SystemManager.php index ea3507c..33d8c19 100644 --- a/core/modules/system/src/SystemManager.php +++ b/core/modules/system/src/SystemManager.php @@ -8,6 +8,7 @@ use Drupal\Core\Menu\MenuLinkTreeInterface; use Drupal\Core\Menu\MenuLinkInterface; +use Drupal\Core\Menu\MenuActiveTrailInterface; use Drupal\Core\Entity\EntityManagerInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Drupal\Core\Database\Connection; @@ -48,6 +49,13 @@ class SystemManager { protected $menuTree; /** + * The menu active trail service. + * + * @var \Drupal\Core\Menu\MenuActiveTrailInterface + */ + protected $menuActiveTrail; + + /** * A static cache of menu items. * * @var array @@ -82,12 +90,15 @@ class SystemManager { * The request stack. * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree * The menu tree manager. + * @param \Drupal\Core\Menu\MenuActiveTrailInterface $menu_active_trail + * Menu active trail service. */ - public function __construct(ModuleHandlerInterface $module_handler, Connection $database, EntityManagerInterface $entity_manager, RequestStack $request_stack, MenuLinkTreeInterface $menu_tree) { + public function __construct(ModuleHandlerInterface $module_handler, Connection $database, EntityManagerInterface $entity_manager, RequestStack $request_stack, MenuLinkTreeInterface $menu_tree, MenuActiveTrailInterface $menu_active_trail) { $this->moduleHandler = $module_handler; $this->database = $database; $this->requestStack = $request_stack; $this->menuTree = $menu_tree; + $this->menuActiveTrail = $menu_active_trail; } /** @@ -177,7 +188,8 @@ public function getBlockContents() { $request = $this->requestStack->getCurrentRequest(); $route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME); $route_parameters = $request->attributes->get('_raw_variables')->all(); - $instance = $this->menuTree->menuLinkGetPreferred($route_name, $route_parameters); + // @todo - use loadLinksByRoute() instead. + $instance = $this->menuActiveTrail->menuLinkGetPreferred($route_name, $route_parameters); if ($instance && $content = $this->getAdminBlock($instance)) { $output = array( '#theme' => 'admin_block_content', @@ -216,7 +228,6 @@ public function getAdminBlock(MenuLinkInterface $instance) { $content[$key]['url'] = $link->getUrlObject(); } ksort($content); - //$this->menuItems[$item['mlid']] = $content; return $content; } diff --git a/core/modules/system/system.services.yml b/core/modules/system/system.services.yml index 6ec802a..46e73e1 100644 --- a/core/modules/system/system.services.yml +++ b/core/modules/system/system.services.yml @@ -5,7 +5,7 @@ services: - { name: access_check, applies_to: _access_system_cron } system.manager: class: Drupal\system\SystemManager - arguments: ['@module_handler', '@database', '@entity.manager', '@request_stack', '@menu.link_tree'] + arguments: ['@module_handler', '@database', '@entity.manager', '@request_stack', '@menu.link_tree', '@menu.active_trail'] system.breadcrumb.default: class: Drupal\system\PathBasedBreadcrumbBuilder arguments: ['@router.request_context', '@access_manager', '@router', '@path_processor_manager', '@config.factory', '@title_resolver', '@current_user']