You are here

public function DeleteActionDeriver::getDerivativeDefinitions in Entity API 8.0

Same name and namespace in other branches
  1. 8 src/Plugin/Action/Derivative/DeleteActionDeriver.php \Drupal\entity\Plugin\Action\Derivative\DeleteActionDeriver::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Action/Derivative/DeleteActionDeriver.php, line 49
Contains \Drupal\entity\Plugin\Action\Derivative\DeleteActionDeriver.

Class

DeleteActionDeriver
Provides a delete action for each content entity type.

Namespace

Drupal\entity\Plugin\Action\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  if (empty($this->derivatives)) {
    $definitions = [];
    foreach ($this
      ->getParticipatingEntityTypes() as $entity_type_id => $entity_type) {
      $definition = $base_plugin_definition;
      $definition['label'] = t('Delete @entity_type', [
        '@entity_type' => $entity_type
          ->getLowercaseLabel(),
      ]);
      $definition['type'] = $entity_type_id;
      $definition['confirm_form_route_name'] = 'entity.' . $entity_type_id . '.delete_multiple_form';
      $definitions[$entity_type_id] = $definition;
    }
    $this->derivatives = $definitions;
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}