class AddComponentDeriver

@internal This API is experimental.

Hierarchy

Expanded class hierarchy of AddComponentDeriver

1 file declares its use of AddComponentDeriver
AddComponent.php in core/modules/layout_builder/src/Plugin/ConfigAction/AddComponent.php

File

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

Namespace

Drupal\layout_builder\Plugin\ConfigAction\Deriver
View source
final class AddComponentDeriver extends DeriverBase implements ContainerDeriverInterface {
    public function __construct(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;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AddComponentDeriver::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
AddComponentDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
AddComponentDeriver::__construct public function
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.