You are here

class MenuTokenMenuLinkManager in Menu Token 8

Same name and namespace in other branches
  1. 9.1.x src/Service/MenuTokenMenuLinkManager.php \Drupal\menu_token\Service\MenuTokenMenuLinkManager

Manages discovery, instantiation, and tree building of menu link plugins.

This manager finds plugins that are rendered as menu links.

Hierarchy

Expanded class hierarchy of MenuTokenMenuLinkManager

1 string reference to 'MenuTokenMenuLinkManager'
menu_token.services.yml in ./menu_token.services.yml
menu_token.services.yml
1 service uses MenuTokenMenuLinkManager
menu_token.manager.menu.link in ./menu_token.services.yml
Drupal\menu_token\Service\MenuTokenMenuLinkManager

File

src/Service/MenuTokenMenuLinkManager.php, line 12

Namespace

Drupal\menu_token\Service
View source
class MenuTokenMenuLinkManager extends MenuLinkManager {

  /**
   * {@inheritdoc}
   */
  public function rebuildMenuToken($definitions) {
    try {
      $this->moduleHandler
        ->invoke("menu_token", "prepare_context_replacement", [
        &$definitions,
      ]);
    } catch (\Exception $e) {
    }
    $mtts = \Drupal::service('menu_token.tree_storage');
    $mtts
      ->rebuildNonDestructive($definitions);
  }

  /**
   * {@inheritdoc}
   */
  public function getMenuTreeStorage() {
    return $this->treeStorage;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MenuLinkManager::$defaults protected property Provides some default values for the definition of all menu link plugins.
MenuLinkManager::$discovery protected property The object that discovers plugins managed by this manager.
MenuLinkManager::$factory protected property The object that instantiates plugins managed by this manager.
MenuLinkManager::$moduleHandler protected property The module handler.
MenuLinkManager::$overrides protected property Service providing overrides for static links.
MenuLinkManager::$treeStorage protected property The menu link tree storage.
MenuLinkManager::addDefinition public function Adds a new menu link definition to the menu tree storage. Overrides MenuLinkManagerInterface::addDefinition
MenuLinkManager::countMenuLinks public function Counts the total number of menu links. Overrides MenuLinkManagerInterface::countMenuLinks
MenuLinkManager::createInstance public function Returns a pre-configured menu link plugin instance. Overrides FactoryInterface::createInstance
MenuLinkManager::deleteInstance protected function Deletes a specific instance.
MenuLinkManager::deleteLinksInMenu public function Deletes all links having a certain menu name. Overrides MenuLinkManagerInterface::deleteLinksInMenu
MenuLinkManager::getChildIds public function Loads all child link IDs of a given menu link, regardless of visibility. Overrides MenuLinkManagerInterface::getChildIds
MenuLinkManager::getDefinition public function Gets a specific plugin definition. Overrides DiscoveryInterface::getDefinition
MenuLinkManager::getDefinitions public function Gets the definition of all plugins for this type. Overrides DiscoveryInterface::getDefinitions
MenuLinkManager::getDiscovery protected function Gets the plugin discovery.
MenuLinkManager::getFactory protected function Gets the plugin factory.
MenuLinkManager::getInstance public function Gets a preconfigured instance of a plugin. Overrides MapperInterface::getInstance
MenuLinkManager::getParentIds public function Loads all parent link IDs of a given menu link. Overrides MenuLinkManagerInterface::getParentIds
MenuLinkManager::hasDefinition public function Indicates if a specific plugin definition exists. Overrides DiscoveryInterface::hasDefinition
MenuLinkManager::loadLinksByRoute public function Loads multiple plugin instances based on route. Overrides MenuLinkManagerInterface::loadLinksByRoute
MenuLinkManager::menuNameInUse public function Determines if any links use a given menu name. Overrides MenuLinkManagerInterface::menuNameInUse
MenuLinkManager::processDefinition protected function Performs extra processing on plugin definitions.
MenuLinkManager::rebuild public function Triggers discovery, save, and cleanup of discovered links. Overrides MenuLinkManagerInterface::rebuild
MenuLinkManager::removeDefinition public function Removes a single link definition from the menu tree storage. Overrides MenuLinkManagerInterface::removeDefinition
MenuLinkManager::resetDefinitions public function Resets any local definition cache. Used for testing. Overrides MenuLinkManagerInterface::resetDefinitions
MenuLinkManager::resetInstance protected function Resets the menu link to its default settings.
MenuLinkManager::resetLink public function Resets the values for a menu link based on the values found by discovery. Overrides MenuLinkManagerInterface::resetLink
MenuLinkManager::updateDefinition public function Updates the values for a menu link definition in the menu tree storage. Overrides MenuLinkManagerInterface::updateDefinition
MenuLinkManager::__construct public function Constructs a \Drupal\Core\Menu\MenuLinkManager object.
MenuTokenMenuLinkManager::getMenuTreeStorage public function
MenuTokenMenuLinkManager::rebuildMenuToken public function