function PluginManagerBase::createInstance

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::createInstance()
  2. 10 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::createInstance()
  3. 11.x core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::createInstance()
19 calls to PluginManagerBase::createInstance()
BreakpointManager::getBreakpointsByGroup in core/modules/breakpoint/src/BreakpointManager.php
Gets breakpoints for the specified group.
CKEditor5PluginManager::getPlugin in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
Returns a CKEditor 5 plugin with configuration from the editor.
CKEditorPluginManager::getButtons in core/modules/ckeditor/src/CKEditorPluginManager.php
Retrieves all available CKEditor buttons, keyed by plugin ID.
CKEditorPluginManager::getCssFiles in core/modules/ckeditor/src/CKEditorPluginManager.php
Retrieves enabled plugins' iframe instance CSS files, keyed by plugin ID.
CKEditorPluginManager::getEnabledPluginFiles in core/modules/ckeditor/src/CKEditorPluginManager.php
Retrieves enabled plugins' files, keyed by plugin ID.

... See full list

12 methods override PluginManagerBase::createInstance()
ArchiverManager::createInstance in core/lib/Drupal/Core/Archiver/ArchiverManager.php
ConditionManager::createInstance in core/lib/Drupal/Core/Condition/ConditionManager.php
ElementInfoManager::createInstance in core/lib/Drupal/Core/Render/ElementInfoManager.php
FieldTypePluginManager::createInstance in core/lib/Drupal/Core/Field/FieldTypePluginManager.php
Creates a field item, which is not part of an entity or field item list.
FormatterPluginManager::createInstance in core/lib/Drupal/Core/Field/FormatterPluginManager.php

... See full list

File

core/lib/Drupal/Component/Plugin/PluginManagerBase.php, line 71

Class

PluginManagerBase
Base class for plugin managers.

Namespace

Drupal\Component\Plugin

Code

public function createInstance($plugin_id, array $configuration = []) {
    // If this PluginManager has fallback capabilities catch
    // PluginNotFoundExceptions.
    if ($this instanceof FallbackPluginManagerInterface) {
        try {
            return $this->getFactory()
                ->createInstance($plugin_id, $configuration);
        } catch (PluginNotFoundException $e) {
            return $this->handlePluginNotFound($plugin_id, $configuration);
        }
    }
    else {
        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.