private function ContentDevelGenerate::generateBatchContent in Devel 8
Same name and namespace in other branches
- 8.3 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::generateBatchContent()
- 8.2 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::generateBatchContent()
- 4.x devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::generateBatchContent()
Method responsible for creating content when the number of elements is greater than 50.
1 call to ContentDevelGenerate::generateBatchContent()
- ContentDevelGenerate::generateElements in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - Business logic relating with each DevelGenerate plugin
File
- devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php, line 333
Class
- ContentDevelGenerate
- Provides a ContentDevelGenerate plugin.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
private function generateBatchContent($values) {
// Setup the batch operations and save the variables.
$operations[] = array(
'devel_generate_operation',
array(
$this,
'batchContentPreNode',
$values,
),
);
// Add the kill operation.
if ($values['kill']) {
$operations[] = array(
'devel_generate_operation',
array(
$this,
'batchContentKill',
$values,
),
);
}
// Add the operations to create the nodes.
for ($num = 0; $num < $values['num']; $num++) {
$operations[] = array(
'devel_generate_operation',
array(
$this,
'batchContentAddNode',
$values,
),
);
}
// Set the batch.
$batch = array(
'title' => $this
->t('Generating Content'),
'operations' => $operations,
'finished' => 'devel_generate_batch_finished',
'file' => drupal_get_path('module', 'devel_generate') . '/devel_generate.batch.inc',
);
batch_set($batch);
}