function MenuLinkManagerInterface::addDefinition

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php \Drupal\Core\Menu\MenuLinkManagerInterface::addDefinition()
  2. 10 core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php \Drupal\Core\Menu\MenuLinkManagerInterface::addDefinition()
  3. 11.x core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php \Drupal\Core\Menu\MenuLinkManagerInterface::addDefinition()

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 the newly added definition.

Throws

\Drupal\Component\Plugin\Exception\PluginException Thrown when the $id is not valid or is an already existing plugin ID.

1 method overrides MenuLinkManagerInterface::addDefinition()
MenuLinkManager::addDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Adds a new menu link definition to the menu tree storage.

File

core/lib/Drupal/Core/Menu/MenuLinkManagerInterface.php, line 94

Class

MenuLinkManagerInterface
Defines an interface for managing menu links and storing their definitions.

Namespace

Drupal\Core\Menu

Code

public function addDefinition($id, array $definition);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.