Пример #1
0
 public function extrasQuestion(DrupalVmStyle $io)
 {
     if ($io->confirm('Do you want to install add any packages to installed_extras?', false)) {
         $selectedExtras = [];
         $io->writeln("\nType the package name from installed_extras or use keyup or keydown.\nThis is optional, press <info>enter</info> to <info>continue</info>.\n");
         $extras = self::$extras;
         while (true) {
             // Prompt the user to enter the name of the extra.
             $extra = $io->choiceNoList('Enter the name of the extra', $extras, null, true);
             // Remove any whitespace and ensure that the input is not empty.
             $extra = trim($extra);
             if (empty($extra)) {
                 break;
             }
             // Push the item into the selected extras array.
             array_push($selectedExtras, $extra);
             // Remove the selected item from the available options.
             $key = array_search($extra, $extras, true);
             if ($key >= 0) {
                 unset($extras[$key]);
                 // Reset the array keys to avoid undefined offset errors.
                 $extras = array_values($extras);
             }
         }
         return $selectedExtras;
     }
 }
 public function packagesQuestion(DrupalVmStyle $io)
 {
     if ($io->confirm('Do you want to install add any additional packages?', false)) {
         $extraPackages = [];
         // $io->writeln("\nType the package name from installed_extras or use keyup or keydown.\nThis is optional, press <info>enter</info> to <info>continue</info>.\n");
         while (true) {
             $package = $io->askEmpty('Enter the name of the package to install');
             $package = trim($package);
             if (empty($package)) {
                 break;
             }
             array_push($extraPackages, $package);
         }
         return $extraPackages;
     }
 }