function EntityActionDeriverBase::getApplicableEntityTypes

Same name in other branches
  1. 9 core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getApplicableEntityTypes()
  2. 10 core/lib/Drupal/Core/Action/Plugin/Action/Derivative/EntityActionDeriverBase.php \Drupal\Core\Action\Plugin\Action\Derivative\EntityActionDeriverBase::getApplicableEntityTypes()
  3. 11.x 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;
}

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