function WidgetPluginManager::createInstance
Same name in other branches
- 9 core/lib/Drupal/Core/Field/WidgetPluginManager.php \Drupal\Core\Field\WidgetPluginManager::createInstance()
- 8.9.x core/lib/Drupal/Core/Field/WidgetPluginManager.php \Drupal\Core\Field\WidgetPluginManager::createInstance()
- 10 core/lib/Drupal/Core/Field/WidgetPluginManager.php \Drupal\Core\Field\WidgetPluginManager::createInstance()
Overrides PluginManagerBase::createInstance
1 call to WidgetPluginManager::createInstance()
- WidgetPluginManager::getInstance in core/
lib/ Drupal/ Core/ Field/ WidgetPluginManager.php - Overrides PluginManagerBase::getInstance().
File
-
core/
lib/ Drupal/ Core/ Field/ WidgetPluginManager.php, line 117
Class
- WidgetPluginManager
- Plugin type manager for field widgets.
Namespace
Drupal\Core\FieldCode
public function createInstance($plugin_id, array $configuration = []) {
$plugin_definition = $this->getDefinition($plugin_id);
$plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);
// If the plugin provides a factory method, pass the container to it.
if (is_subclass_of($plugin_class, 'Drupal\\Core\\Plugin\\ContainerFactoryPluginInterface')) {
return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition);
}
return new $plugin_class($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['third_party_settings']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.