class MenuTreeStorageMenuHelper in Menu Trail By Path 8
Hierarchy
- class \Drupal\menu_trail_by_path\Menu\MenuTreeStorageMenuHelper implements MenuHelperInterface
Expanded class hierarchy of MenuTreeStorageMenuHelper
1 string reference to 'MenuTreeStorageMenuHelper'
1 service uses MenuTreeStorageMenuHelper
File
- src/
Menu/ MenuTreeStorageMenuHelper.php, line 8
Namespace
Drupal\menu_trail_by_path\MenuView source
class MenuTreeStorageMenuHelper implements MenuHelperInterface {
/**
* @var MenuLinkManagerInterface
*/
protected $menuLinkManager;
/**
* @var MenuTreeStorageInterface
*/
protected $menuTreeStorage;
/**
* MenuTreeStorageMenuHelper constructor.
* @param \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager
* @param \Drupal\Core\Menu\MenuTreeStorageInterface $menu_tree_storage
*/
public function __construct(MenuLinkManagerInterface $menu_link_manager, MenuTreeStorageInterface $menu_tree_storage) {
$this->menuLinkManager = $menu_link_manager;
$this->menuTreeStorage = $menu_tree_storage;
}
/**
* {@inheritdoc}
*/
public function getMenuLinks($menu_name) {
// nice to have: implement filtering like public/core/lib/Drupal/Core/Menu/MenuLinkTree.php:153
$menu_links = [];
$menu_plugins = $this->menuTreeStorage
->loadByProperties([
'menu_name' => $menu_name,
]);
foreach ($menu_plugins as $plugin_id => $definition) {
$menu_links[$plugin_id] = $this->menuLinkManager
->createInstance($plugin_id);
}
return $menu_links;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MenuTreeStorageMenuHelper:: |
protected | property | ||
MenuTreeStorageMenuHelper:: |
protected | property | ||
MenuTreeStorageMenuHelper:: |
public | function |
Overrides MenuHelperInterface:: |
|
MenuTreeStorageMenuHelper:: |
public | function | MenuTreeStorageMenuHelper constructor. |