MenuLinkManagerInterface::deleteLinksInMenu

public MenuLinkManagerInterface::deleteLinksInMenu($menu_name) Deletes all links having a certain menu name. If a link is not deletable but is resettable, the link will be reset to have its original menu name, under the assumption that the original menu is not the one we are deleting it from. Note that when resetting, if the original menu name is the same as the menu name passed to this method, the link will not be moved or deleted. Parameters string $menu_name: The name of the menu whose link

MenuLinkManagerInterface::countMenuLinks

public MenuLinkManagerInterface::countMenuLinks($menu_name = NULL) Counts the total number of menu links. Parameters string $menu_name: (optional) The menu name to count by. Defaults to all menus. Return value int The number of menu links in the named menu, or in all menus if the menu name is NULL. File core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php, line 146 Class MenuLinkManagerInterface Defines an interface for managing menu links and storing their definitions. Namespace Dr

MenuLinkManagerInterface::addDefinition

public MenuLinkManagerInterface::addDefinition($id, array $definition) Adds a new menu link definition to the menu tree storage. Use this function when you know there is no entry in the tree. This is used for plugins not found through discovery to add new definitions. Parameters string $id: The plugin ID for the new menu link definition that is being added. array $definition: The values of the link definition. Return value \Drupal\Core\Menu\MenuLinkInterface A plugin instance created using th

MenuLinkManagerInterface

Defines an interface for managing menu links and storing their definitions. Menu link managers support both automatic plugin definition discovery and manually maintaining plugin definitions. MenuLinkManagerInterface::updateDefinition() can be used to update a single menu link's definition and pass this onto the menu storage without requiring a full MenuLinkManagerInterface::rebuild(). Implementations that do not use automatic discovery should call MenuLinkManagerInterface::addDefinition() or Me

MenuLinkManager::__construct

public MenuLinkManager::__construct(MenuTreeStorageInterface $tree_storage, StaticMenuLinkOverridesInterface $overrides, ModuleHandlerInterface $module_handler) Constructs a \Drupal\Core\Menu\MenuLinkManager object. Parameters \Drupal\Core\Menu\MenuTreeStorageInterface $tree_storage: The menu link tree storage. \Drupal\Core\Menu\StaticMenuLinkOverridesInterface $overrides: The service providing overrides for static links. \Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The modul

MenuLinkManager::updateDefinition

public MenuLinkManager::updateDefinition($id, array $new_definition_values, $persist = TRUE) Updates the values for a menu link definition in the menu tree storage. This will update the definition for a discovered menu link without the need for a full rebuild. It is also used for plugins not found through discovery to update definitions. Parameters string $id: The menu link plugin ID. array $new_definition_values: The new values for the link definition. This will usually be just a subset of th

MenuLinkManager::resetLink

public MenuLinkManager::resetLink($id) Resets the values for a menu link based on the values found by discovery. Parameters string $id: The menu link plugin ID. Return value \Drupal\Core\Menu\MenuLinkInterface The menu link instance after being reset. Throws \Drupal\Component\Plugin\Exception\PluginException Thrown if the $id is not a valid, existing, plugin ID or if the link cannot be reset. Overrides MenuLinkManagerInterface::resetLink File core/lib/Drupal/Core/Menu/MenuLinkManager.php, li

MenuLinkManager::resetInstance

protected MenuLinkManager::resetInstance(MenuLinkInterface $instance) Resets the menu link to its default settings. Parameters \Drupal\Core\Menu\MenuLinkInterface $instance: The menu link which should be reset. Return value \Drupal\Core\Menu\MenuLinkInterface The reset menu link. Throws \Drupal\Component\Plugin\Exception\PluginException Thrown when the menu link is not resettable. File core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 396 Class MenuLinkManager Manages discovery, insta

MenuLinkManager::resetDefinitions

public MenuLinkManager::resetDefinitions() Resets any local definition cache. Used for testing. Overrides MenuLinkManagerInterface::resetDefinitions File core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 413 Class MenuLinkManager Manages discovery, instantiation, and tree building of menu link plugins. Namespace Drupal\Core\Menu Code public function resetDefinitions() { $this->treeStorage->resetDefinitions(); }

MenuLinkManager::removeDefinition

public MenuLinkManager::removeDefinition($id, $persist = TRUE) Removes a single link definition from the menu tree storage. This is used for plugins not found through discovery to remove definitions. Parameters string $id: The menu link plugin ID. bool $persist: If TRUE, this method will attempt to persist the deletion from any external storage by invoking MenuLinkInterface::deleteLink() on the plugin that is being deleted. Throws \Drupal\Component\Plugin\Exception\PluginException Thrown if t