function ContentDevelGenerate::batchContentAddNode

Same name in other branches
  1. 8.x-1.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::batchContentAddNode()
  2. 4.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::batchContentAddNode()

Batch wrapper for calling ContentAddNode.

File

devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php, line 483

Class

ContentDevelGenerate
Provides a ContentDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

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