function AddComponentDeriver::getDerivativeDefinitions

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/layout_builder/src/Plugin/ConfigAction/Deriver/AddComponentDeriver.php, line 36

Class

AddComponentDeriver
@internal This API is experimental.

Namespace

Drupal\layout_builder\Plugin\ConfigAction\Deriver

Code

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.