class AddComponentDeriver
@internal This API is experimental.
Hierarchy
- class \Drupal\layout_builder\Plugin\ConfigAction\Deriver\AddComponentDeriver extends \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface implements \Drupal\Component\Plugin\Derivative\DeriverBase
Expanded class hierarchy of AddComponentDeriver
2 files declare their use of AddComponentDeriver
- AddComponent.php in core/
modules/ layout_builder/ src/ Plugin/ ConfigAction/ AddComponent.php - AddComponentDeriverTest.php in core/
modules/ layout_builder/ tests/ src/ Unit/ Plugin/ ConfigAction/ Deriver/ AddComponentDeriverTest.php
File
-
core/
modules/ layout_builder/ src/ Plugin/ ConfigAction/ Deriver/ AddComponentDeriver.php, line 18
Namespace
Drupal\layout_builder\Plugin\ConfigAction\DeriverView source
final class AddComponentDeriver extends DeriverBase implements ContainerDeriverInterface {
public function __construct(private readonly EntityTypeManagerInterface $entityTypeManager) {
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) : static {
return new static($container->get(EntityTypeManagerInterface::class));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) : array {
$entity_types = [];
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type) {
if ($entity_type->entityClassImplements(ConfigEntityInterface::class) && $entity_type->entityClassImplements(SectionListInterface::class)) {
$entity_types[] = $entity_type->id();
}
}
$base_plugin_definition['entity_types'] = $entity_types;
$this->derivatives['addComponentToLayout'] = $base_plugin_definition;
return $this->derivatives;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.