function BlockContentDevelGenerate::batchContentAddBlock

Batch wrapper for calling ContentAddBlock.

File

devel_generate/src/Plugin/DevelGenerate/BlockContentDevelGenerate.php, line 288

Class

BlockContentDevelGenerate
Provides a BlockContentDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function batchContentAddBlock(array $vars, array &$context) : void {
  if (!isset($context['results']['num'])) {
    $context['results']['num'] = 0;
  }
  if ($this->drushBatch) {
    ++$context['results']['num'];
    $this->develGenerateContentAddBlock($vars);
  }
  else {
    $context['results'] = $vars;
    $this->develGenerateContentAddBlock($context['results']);
  }
  if (!empty($vars['num_translations'])) {
    $context['results']['num_translations'] += $vars['num_translations'];
  }
}