X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FShared%2FThemeRegionTrait.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FShared%2FThemeRegionTrait.php;h=cf0e2480ee024695c750e36aba0d154fdf96dd4d;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console/src/Command/Shared/ThemeRegionTrait.php b/vendor/drupal/console/src/Command/Shared/ThemeRegionTrait.php new file mode 100644 index 000000000..cf0e2480e --- /dev/null +++ b/vendor/drupal/console/src/Command/Shared/ThemeRegionTrait.php @@ -0,0 +1,57 @@ +validator; + $regions = []; + while (true) { + $regionName = $io->ask( + $this->trans('commands.generate.theme.questions.region-name'), + 'Content' + ); + + $regionMachineName = $this->stringConverter->createMachineName($regionName); + $regionMachineName = $io->ask( + $this->trans('commands.generate.theme.questions.region-machine-name'), + $regionMachineName, + function ($regionMachineName) use ($validators) { + return $validators->validateMachineName($regionMachineName); + } + ); + + array_push( + $regions, + [ + 'region_name' => $regionName, + 'region_machine_name' => $regionMachineName, + ] + ); + + if (!$io->confirm( + $this->trans('commands.generate.theme.questions.region-add'), + true + ) + ) { + break; + } + } + + return $regions; + } +}