diff --git a/core/includes/menu.inc b/core/includes/menu.inc index e4015d5..3af5bb9 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -524,7 +524,7 @@ function menu_navigation_links($menu_name, $level = 0) { } // Get the menu hierarchy for the current page. - /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ + /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ $menu_tree = \Drupal::service('menu_link.tree'); $tree = $menu_tree->buildPageData($menu_name, $level + 1); diff --git a/core/modules/menu/lib/Drupal/menu/MenuFormController.php b/core/modules/menu/lib/Drupal/menu/MenuFormController.php index 67803f3..a74899d 100644 --- a/core/modules/menu/lib/Drupal/menu/MenuFormController.php +++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php @@ -35,7 +35,7 @@ class MenuFormController extends EntityFormController { protected $menuLinkStorage; /** - * The menu tree. + * The menu tree service. * * @var \Drupal\menu_link\MenuTreeInterface */ @@ -56,7 +56,7 @@ class MenuFormController extends EntityFormController { * @param \Drupal\menu_link\MenuLinkStorageControllerInterface $menu_link_storage * The menu link storage controller. * @param \Drupal\menu_link\MenuTreeInterface $menu_tree - * The menu tree. + * The menu tree service. */ public function __construct(QueryFactory $entity_query_factory, MenuLinkStorageControllerInterface $menu_link_storage, MenuTreeInterface $menu_tree) { $this->entityQueryFactory = $entity_query_factory; diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 786dd93..72bc84f 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -263,7 +263,7 @@ function _menu_get_options($menus, $available_menus, $item) { $limit = _menu_parent_depth_limit($item); } - /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ + /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ $menu_tree = \Drupal::service('menu_link.tree'); $options = array(); diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php index 7060e35..2c3e213 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTree.php @@ -333,11 +333,11 @@ public function getPath($menu_name) { /** * {@inheritdoc} */ - public function getRenderedTree($menu_name) { + public function renderMenu($menu_name) { if (!isset($this->menuOutput[$menu_name])) { $tree = $this->buildPageData($menu_name); - $this->menuOutput[$menu_name] = $this->output($tree); + $this->menuOutput[$menu_name] = $this->renderTree($tree); } return $this->menuOutput[$menu_name]; } @@ -345,7 +345,7 @@ public function getRenderedTree($menu_name) { /** * {@inheritdoc} */ - public function output($tree) { + public function renderTree($tree) { $build = array(); $items = array(); @@ -385,7 +385,7 @@ public function output($tree) { // it is external. $element['#href'] = $data['link']['link_path']; $element['#localized_options'] = !empty($data['link']['localized_options']) ? $data['link']['localized_options'] : array(); - $element['#below'] = $data['below'] ? $this->output($data['below']) : $data['below']; + $element['#below'] = $data['below'] ? $this->renderTree($data['below']) : $data['below']; $element['#original_link'] = $data['link']; // Index using the link's unique mlid. $build[$data['link']['mlid']] = $element; diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeInterface.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeInterface.php index 29cee05..0666c0a 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeInterface.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeInterface.php @@ -26,7 +26,7 @@ * @return array * A structured array to be rendered by drupal_render(). */ - public function output($tree); + public function renderTree($tree); /** * Sets the path for determining the active trail of the specified menu tree. @@ -164,7 +164,7 @@ public function buildAllData($menu_name, $link = NULL, $max_depth = NULL); * A structured array representing the specified menu on the current page, to * be rendered by drupal_render(). */ - public function getRenderedTree($menu_name); + public function renderMenu($menu_name); /** * Builds a menu tree, translates links, and checks access. diff --git a/core/modules/menu_link/tests/Drupal/menu_link/Tests/MenuTreeTest.php b/core/modules/menu_link/tests/Drupal/menu_link/Tests/MenuTreeTest.php index 0c39171..162dead 100644 --- a/core/modules/menu_link/tests/Drupal/menu_link/Tests/MenuTreeTest.php +++ b/core/modules/menu_link/tests/Drupal/menu_link/Tests/MenuTreeTest.php @@ -291,7 +291,7 @@ public function testOutputWithSingleLevel() { ), ); - $output = $this->menuTree->output($tree); + $output = $this->menuTree->renderTree($tree); // Validate that the - in main-menu is changed into an underscore $this->assertEquals($output['1']['#theme'], 'menu_link__main_menu', 'Hyphen is changed to an underscore on menu_link'); @@ -324,7 +324,7 @@ public function testOutputWithComplexData() { '7' => array('link' => array('mlid' => 7, 'title' => 'Item 7', 'in_active_trail' => 0, 'link_path' => 'g') + $this->defaultMenuLink, 'below' => array()) ); - $output = $this->menuTree->output($tree); + $output = $this->menuTree->renderTree($tree); // Looking for child items in the data $this->assertEquals( $output['1']['#below']['2']['#href'], 'a/b', 'Checking the href on a child item'); diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php index 6bc7646..5e0d710 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php @@ -66,7 +66,7 @@ public static function create(ContainerInterface $container, array $configuratio */ public function build() { $menu = $this->getDerivativeId(); - return $this->menuTree->getRenderedTree($menu); + return $this->menuTree->renderMenu($menu); } } diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index e36eb89..dad1cb1 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -358,7 +358,7 @@ function toolbar_toolbar() { // Add attributes to the links before rendering. toolbar_menu_navigation_links($tree); - /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ + /** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */ $menu_tree = \Drupal::service('menu_link.tree'); $menu = array( @@ -368,7 +368,7 @@ function toolbar_toolbar() { '#attributes' => array( 'class' => array('toolbar-menu-administration'), ), - 'administration_menu' => $menu_tree->output($tree), + 'administration_menu' => $menu_tree->renderTree($tree), ), ); @@ -488,7 +488,7 @@ function toolbar_get_rendered_subtrees() { $parents = $query->execute()->fetchCol(); $subtree = $menu_tree->buildTree($item['menu_name'], array('expanded' => $parents, 'min_depth' => $item['depth']+1)); toolbar_menu_navigation_links($subtree); - $subtree = $menu_tree->output($subtree); + $subtree = $menu_tree->renderTree($subtree); $subtree = drupal_render($subtree); } else {