function BatchUserAction::executeMultiple

Same name in other branches
  1. 9 core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php \Drupal\user_batch_action_test\Plugin\Action\BatchUserAction::executeMultiple()
  2. 8.9.x core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php \Drupal\user_batch_action_test\Plugin\Action\BatchUserAction::executeMultiple()
  3. 11.x core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php \Drupal\user_batch_action_test\Plugin\Action\BatchUserAction::executeMultiple()

Overrides ActionBase::executeMultiple

1 call to BatchUserAction::executeMultiple()
BatchUserAction::execute in core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php

File

core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php, line 24

Class

BatchUserAction
Provides action that sets batch precessing.

Namespace

Drupal\user_batch_action_test\Plugin\Action

Code

public function executeMultiple(array $entities) {
    $operations = [];
    foreach ($entities as $entity) {
        $operations[] = [
            [
                static::class,
                'processBatch',
            ],
            [
                [
                    'entity_type' => $entity->getEntityTypeId(),
                    'entity_id' => $entity->id(),
                ],
            ],
        ];
    }
    if ($operations) {
        $batch = [
            'operations' => $operations,
            'finished' => [
                static::class,
                'finishBatch',
            ],
        ];
        batch_set($batch);
    }
}

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