function EntityDeleteActionDeriver::getDerivativeDefinitions

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

Overrides EntityActionDeriverBase::getDerivativeDefinitions

File

core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityDeleteActionDeriver.php, line 17

Class

EntityDeleteActionDeriver
Provides an action deriver that finds entity types with delete form.

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'] = $this->t('Delete @entity_type', [
                '@entity_type' => $entity_type->getSingularLabel(),
            ]);
            $definition['confirm_form_route_name'] = 'entity.' . $entity_type->id() . '.delete_multiple_form';
            $definitions[$entity_type_id] = $definition;
        }
        $this->derivatives = $definitions;
    }
    return $this->derivatives;
}

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