You are here

protected function EntityActionDeriverBase::getApplicableEntityTypes in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getApplicableEntityTypes()

Gets a list of applicable entity types.

The list consists of all entity types which match the conditions for the given deriver. For example, if the action applies to entities that are publishable, this method will find all entity types that are publishable.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] The applicable entity types, keyed by entity type ID.

2 calls to EntityActionDeriverBase::getApplicableEntityTypes()
EntityActionDeriverBase::getDerivativeDefinitions in core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php
Gets the definition of all derivatives of a base plugin.
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 90

Class

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

Namespace

Drupal\Core\Action\Plugin\Action\Derivative

Code

protected function getApplicableEntityTypes() {
  $entity_types = $this->entityTypeManager
    ->getDefinitions();
  $entity_types = array_filter($entity_types, function (EntityTypeInterface $entity_type) {
    return $this
      ->isApplicable($entity_type);
  });
  return $entity_types;
}