function EntityActionDeriverBase::getDerivativeDefinitions

Same name in other branches
  1. 9 core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getDerivativeDefinitions()
  2. 8.9.x core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getDerivativeDefinitions()
  3. 10 core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

1 method overrides EntityActionDeriverBase::getDerivativeDefinitions()
EntityDeleteActionDeriver::getDerivativeDefinitions in core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityDeleteActionDeriver.php
Gets the definition of all derivatives of a base plugin.

File

core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php, line 64

Class

EntityActionDeriverBase
Provides a base action for each entity type with specific interfaces.

Namespace

Drupal\Core\Action\Plugin\Action\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    if (empty($this->derivatives)) {
        $definitions = [];
        foreach ($this->getApplicableEntityTypes() as $entity_type_id => $entity_type) {
            $definition = $base_plugin_definition;
            $definition['type'] = $entity_type_id;
            $definition['label'] = sprintf('%s %s', $base_plugin_definition['action_label'], $entity_type->getSingularLabel());
            $definitions[$entity_type_id] = $definition;
        }
        $this->derivatives = $definitions;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
}

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