Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / devel / devel_generate / src / Plugin / DevelGenerate / UserDevelGenerate.php
index 420ef8ff5fff677f2023de7677b43c5382f83bb2..4e7344b89e80eef28f16f6bace387f0f8b15ad5e 100644 (file)
@@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\devel_generate\DevelGenerateBase;
+use Drush\Utils\StringUtils;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -177,14 +178,26 @@ class UserDevelGenerate extends DevelGenerateBase implements ContainerFactoryPlu
   /**
    * {@inheritdoc}
    */
-  public function validateDrushParams($args) {
+  public function validateDrushParams($args, $options = []) {
     $values = array(
       'num' => array_shift($args),
-      'roles' => drush_get_option('roles') ? explode(',', drush_get_option('roles')) : array(),
-      'kill' => drush_get_option('kill'),
-      'pass' => drush_get_option('pass', NULL),
       'time_range' => 0,
     );
+
+    if ($this->isDrush8()) {
+      $values += [
+        'roles' => explode(',', drush_get_option('roles', '')),
+        'kill' => drush_get_option('kill'),
+        'pass' => drush_get_option('pass', NULL),
+      ];
+    }
+    else {
+      $values += [
+        'roles' => StringUtils::csvToArray($options['roles']),
+        'kill' => $options['kill'],
+        'pass' => $options['pass'],
+      ];
+    }
     return $values;
   }