You are here

protected function DeleteActionDeriver::getParticipatingEntityTypes in Entity API 8

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

Gets a list of participating entity types.

The list consists of all content entity types with a delete-multiple-form link template.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] The participating entity types, keyed by entity type id.

1 call to DeleteActionDeriver::getParticipatingEntityTypes()
DeleteActionDeriver::getDerivativeDefinitions in src/Plugin/Action/Derivative/DeleteActionDeriver.php
Gets the definition of all derivatives of a base plugin.

File

src/Plugin/Action/Derivative/DeleteActionDeriver.php, line 70

Class

DeleteActionDeriver
Provides a delete action for each content entity type.

Namespace

Drupal\entity\Plugin\Action\Derivative

Code

protected function getParticipatingEntityTypes() {
  $entity_types = $this->entityTypeManager
    ->getDefinitions();
  $entity_types = array_filter($entity_types, function (EntityTypeInterface $entity_type) {

    // Core requires a "delete-multiple-confirm" form to be declared as well,
    // if it's missing, it's safe to assume that the entity type is still
    // relying on previous Entity API contrib behavior.
    return $entity_type
      ->hasLinkTemplate('delete-multiple-form') && !$entity_type
      ->hasHandlerClass('form', 'delete-multiple-confirm');
  });
  return $entity_types;
}