You are here

protected function MediaDevelGenerate::preGenerate in Media entity 8

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.

2 calls to MediaDevelGenerate::preGenerate()
MediaDevelGenerate::batchPreGenerate in src/Plugin/DevelGenerate/MediaDevelGenerate.php
Batch version of preGenerate().
MediaDevelGenerate::generateMedia in src/Plugin/DevelGenerate/MediaDevelGenerate.php
Method for creating media when number of elements is less than 50.

File

src/Plugin/DevelGenerate/MediaDevelGenerate.php, line 398

Class

MediaDevelGenerate
Provides a MediaDevelGenerate plugin.

Namespace

Drupal\media_entity\Plugin\DevelGenerate

Code

protected function preGenerate(&$results) {

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