class WebformCompositeDeriver in Webform Composite Tools 8
Provides webform element reusable custom webform composite elements.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\webform_composite\Plugin\Derivative\WebformCompositeDeriver implements ContainerDeriverInterface
Expanded class hierarchy of WebformCompositeDeriver
See also
\Drupal\webform_composite\Plugin\WebformElement\WebformReusableComposite
File
- src/
Plugin/ Derivative/ WebformCompositeDeriver.php, line 15
Namespace
Drupal\webform_composite\Plugin\DerivativeView source
class WebformCompositeDeriver extends DeriverBase implements ContainerDeriverInterface {
/**
* The Reusable Composite storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $compositeStorage;
/**
* Constructs new WebformReusableCompositeDeriver.
*
* @param Drupal\Core\Entity\EntityStorageInterface $composite_storage
* The Dynamic Composite storage.
*/
public function __construct(EntityStorageInterface $composite_storage) {
$this->compositeStorage = $composite_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager')
->getStorage('webform_composite'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$composites = $this->compositeStorage
->loadMultiple();
foreach ($composites as $composite) {
$this->derivatives[$composite
->id()] = $base_plugin_definition;
$this->derivatives[$composite
->id()]['label'] = $composite
->label();
}
return $this->derivatives;
}
}
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:: |
|
WebformCompositeDeriver:: |
protected | property | The Reusable Composite storage. | |
WebformCompositeDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
WebformCompositeDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
WebformCompositeDeriver:: |
public | function | Constructs new WebformReusableCompositeDeriver. |