You are here

public function TBMegaMenuBuilder::getMenuItem in The Better Mega Menu 2.x

Same name and namespace in other branches
  1. 8 src/TBMegaMenuBuilder.php \Drupal\tb_megamenu\TBMegaMenuBuilder::getMenuItem()

Find a menu item.

Parameters

string $menu_name: Menu machine name.

string $plugin_id: The menu item plugin id.

Return value

\Drupal\Core\Menu\MenuLinkTreeElement The menu item element.

Overrides TBMegaMenuBuilderInterface::getMenuItem

File

src/TBMegaMenuBuilder.php, line 103

Class

TBMegaMenuBuilder
Defines a TBMegaMenuBuilder.

Namespace

Drupal\tb_megamenu

Code

public function getMenuItem(string $menu_name, string $plugin_id) {
  $tree =& drupal_static(__FUNCTION__);
  if (is_null($tree)) {
    $tree = $this->menuTree
      ->load($menu_name, (new MenuTreeParameters())
      ->onlyEnabledLinks());
  }
  $item = self::findMenuItem($tree, $plugin_id);
  return $item;
}