You are here

public function MenuLinkManager::createInstance in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::createInstance()
  2. 9 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::createInstance()

Returns a pre-configured menu link plugin instance.

Parameters

string $plugin_id: The ID of the plugin being instantiated.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

\Drupal\Core\Menu\MenuLinkInterface A menu link instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.

Overrides FactoryInterface::createInstance

8 calls to MenuLinkManager::createInstance()
MenuLinkManager::addDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Adds a new menu link definition to the menu tree storage.
MenuLinkManager::deleteLinksInMenu in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Deletes all links having a certain menu name.
MenuLinkManager::getInstance in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Gets a preconfigured instance of a plugin.
MenuLinkManager::loadLinksByRoute in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Loads multiple plugin instances based on route.
MenuLinkManager::removeDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php
Removes a single link definition from the menu tree storage.

... See full list

File

core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 232

Class

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

Namespace

Drupal\Core\Menu

Code

public function createInstance($plugin_id, array $configuration = []) {
  return $this
    ->getFactory()
    ->createInstance($plugin_id, $configuration);
}