public function MediaDevelGenerate::batchCreateMediaItem in Devel 8.3
Same name and namespace in other branches
- 4.x devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\MediaDevelGenerate::batchCreateMediaItem()
Provides a batch version of createMediaItem().
Parameters
array $vars: The input values from the settings form.
array $context: Batch job context.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException Thrown if the storage handler couldn't be loaded.
\Drupal\Component\Plugin\Exception\PluginNotFoundException Thrown if the entity type doesn't exist.
\Drupal\Core\Entity\EntityStorageException Thrown if the bundle does not exist or was needed but not specified.
See also
File
- devel_generate/
src/ Plugin/ DevelGenerate/ MediaDevelGenerate.php, line 368
Class
- MediaDevelGenerate
- Provides a plugin that generates media entities.
Namespace
Drupal\devel_generate\Plugin\DevelGenerateCode
public function batchCreateMediaItem(array $vars, &$context) {
if ($this->drushBatch) {
$this
->createMediaItem($vars);
}
else {
$this
->createMediaItem($context['results']);
}
$context['results']['num']++;
}