You are here

protected function MediaDevelGenerate::preGenerate in Devel 4.x

Same name and namespace in other branches
  1. 8.3 devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\MediaDevelGenerate::preGenerate()

Code to be run before generating items.

Returns the same array passed in as parameter, but with an array of uids for the key 'users'.

Parameters

array $results: The input values from the settings form.

3 calls to MediaDevelGenerate::preGenerate()
MediaDevelGenerate::batchPreGenerate in devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php
Provides a batch version of preGenerate().
MediaDevelGenerate::generateMedia in devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php
Method for creating media when number of elements is less than 50.
MediaDevelGenerate::validateDrushParams in devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php
Responsible for validating Drush params.

File

devel_generate/src/Plugin/DevelGenerate/MediaDevelGenerate.php, line 465

Class

MediaDevelGenerate
Provides a plugin that generates media entities.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

protected function preGenerate(array &$results) {

  // Get user id.
  $users = array_values($this->userStorage
    ->getQuery()
    ->range(0, 50)
    ->execute());
  $users = array_merge($users, [
    '0',
  ]);
  $results['users'] = $users;
}