You are here

public static function EntityReferenceActionsHandler::batchCallback in Entity reference actions 1.x

Call action in batch.

Parameters

int $entity_id: The entity ID.

string $entity_type_id: The entity type ID.

string $action_id: The action ID.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/EntityReferenceActionsHandler.php, line 375

Class

EntityReferenceActionsHandler
Provides the form functions to call actions on referenced entities.

Namespace

Drupal\entity_reference_actions

Code

public static function batchCallback($entity_id, $entity_type_id, $action_id) {
  $entity_type_manager = \Drupal::entityTypeManager();

  /** @var \Drupal\system\ActionConfigEntityInterface $action */
  $action = $entity_type_manager
    ->getStorage('action')
    ->load($action_id);
  $entity = $entity_type_manager
    ->getStorage($entity_type_id)
    ->load($entity_id);
  $action
    ->getPlugin()
    ->executeMultiple([
    $entity,
  ]);
}