class PluginSelectorDeriver in Plugin 8.2
Derives plugin selector field widgets.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\plugin\Plugin\Field\FieldWidget\PluginSelectorDeriver implements ContainerDeriverInterface
Expanded class hierarchy of PluginSelectorDeriver
1 file declares its use of PluginSelectorDeriver
- PluginSelectorDeriverTest.php in tests/
src/ Unit/ Plugin/ Field/ FieldWidget/ PluginSelectorDeriverTest.php
File
- src/
Plugin/ Field/ FieldWidget/ PluginSelectorDeriver.php, line 13
Namespace
Drupal\plugin\Plugin\Field\FieldWidgetView source
class PluginSelectorDeriver extends DeriverBase implements ContainerDeriverInterface {
/**
* The plugin selector manager.
*
* @var \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorManagerInterface
*/
protected $pluginSelectorManager;
/**
* Constructs a new class instance.
*/
public function __construct(PluginSelectorManagerInterface $plugin_selector_manager) {
$this->pluginSelectorManager = $plugin_selector_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('plugin.manager.plugin.plugin_selector'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->pluginSelectorManager
->getDefinitions() as $plugin_id => $plugin_definition) {
$this->derivatives[$plugin_id] = [
'description' => isset($plugin_definition['description']) ? $plugin_definition['description'] : NULL,
'label' => $plugin_definition['label'],
'plugin_selector_id' => $plugin_id,
] + $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
PluginSelectorDeriver:: |
protected | property | The plugin selector manager. | |
PluginSelectorDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
PluginSelectorDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
PluginSelectorDeriver:: |
public | function | Constructs a new class instance. |