function MenuLinkManager::createInstance

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::createInstance()
  2. 8.9.x core/lib/Drupal/Core/Menu/MenuLinkManager.php \Drupal\Core\Menu\MenuLinkManager::createInstance()
  3. 11.x 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.

8 calls to MenuLinkManager::createInstance()
MenuLinkManager::addDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php
MenuLinkManager::deleteLinksInMenu in core/lib/Drupal/Core/Menu/MenuLinkManager.php
MenuLinkManager::getInstance in core/lib/Drupal/Core/Menu/MenuLinkManager.php
MenuLinkManager::loadLinksByRoute in core/lib/Drupal/Core/Menu/MenuLinkManager.php
MenuLinkManager::removeDefinition in core/lib/Drupal/Core/Menu/MenuLinkManager.php

... See full list

File

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

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);
}

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