public function PluginManagerBase::createInstance in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::createInstance()
- 9 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::createInstance()
Creates a pre-configured instance of a plugin.
Parameters
string $plugin_id: The ID of the plugin being instantiated.
array $configuration: An array of configuration relevant to the plugin instance.
Return value
object A fully configured plugin instance.
Throws
\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.
Overrides FactoryInterface::createInstance
22 calls to PluginManagerBase::createInstance()
- BreakpointManager::getBreakpointsByGroup in core/
modules/ breakpoint/ src/ BreakpointManager.php - Gets breakpoints for the specified group.
- CKEditor4To5UpgradePluginManager::computeCKEditor5PluginSubsetConfiguration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Computes elements subset configuration for CKEditor 5 plugin.
- CKEditor4To5UpgradePluginManager::mapCKEditor4SettingsToCKEditor5Configuration in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Maps CKEditor 4 settings to the CKEditor 5 equivalent, if needed.
- CKEditor4To5UpgradePluginManager::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor4To5UpgradePluginManager.php - Maps a CKEditor 4 button to the CKEditor 5 equivalent, if it exists.
- CKEditor5PluginManager::getPlugin in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5PluginManager.php - Returns a CKEditor 5 plugin with configuration from the editor.
12 methods override PluginManagerBase::createInstance()
- ArchiverManager::createInstance in core/
lib/ Drupal/ Core/ Archiver/ ArchiverManager.php - Creates a pre-configured instance of a plugin.
- ConditionManager::createInstance in core/
lib/ Drupal/ Core/ Condition/ ConditionManager.php - Creates a pre-configured instance of a plugin.
- 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 - Creates a pre-configured instance of a plugin.
File
- core/
lib/ Drupal/ Component/ Plugin/ PluginManagerBase.php, line 71
Class
- PluginManagerBase
- Base class for plugin managers.
Namespace
Drupal\Component\PluginCode
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);
}
}