public function BatchUserAction::executeMultiple in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php \Drupal\user_batch_action_test\Plugin\Action\BatchUserAction::executeMultiple()
- 9 core/modules/views/tests/modules/user_batch_action_test/src/Plugin/Action/BatchUserAction.php \Drupal\user_batch_action_test\Plugin\Action\BatchUserAction::executeMultiple()
Executes the plugin for an array of objects.
Parameters
array $objects: An array of entities.
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 - Executes the plugin.
File
- core/
modules/ views/ tests/ modules/ user_batch_action_test/ src/ Plugin/ Action/ BatchUserAction.php, line 23
Class
- BatchUserAction
- Provides action that sets batch precessing.
Namespace
Drupal\user_batch_action_test\Plugin\ActionCode
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);
}
}