function BatchUserAction::processBatch

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::processBatch()
  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::processBatch()
  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::processBatch()

Processes the batch item.

Parameters

array $data: Keyed array of data to process.

array $context: The batch context.

File

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

Class

BatchUserAction
Provides action that sets batch precessing.

Namespace

Drupal\user_batch_action_test\Plugin\Action

Code

public static function processBatch($data, &$context) {
    if (!isset($context['results']['processed'])) {
        $context['results']['processed'] = 0;
        $context['results']['theme'] = \Drupal::service('theme.manager')->getActiveTheme(\Drupal::routeMatch())
            ->getName();
    }
    $context['results']['processed']++;
}

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