lithium\console\command\g11n\Extract::_configuration()
Helps in selecting or - if required - adding a new Catalog
collection
used for extracting or writing the template. A special configuration
with the name temporary
may be created. Should a configuration with
that same name exist prior to entering this method it will be unset.
Parameters
-
array
$options
Options paired with defaults to prompt for.
Returns
stringThe name of the selected or newly created configuration.
Source
protected function _configuration(array $options = []) {
$configs = (array) Catalog::config();
if (isset($configs['temporary'])) {
unset($configs['temporary']);
}
if ($configs) {
$this->out('Available `Catalog` Configurations:');
$prompt = 'Please choose a configuration or hit enter to add a new one:';
foreach ($configs as $name => $config) {
$this->out(" - {$name}");
}
} else {
$this->out(' - No configuration found. -');
$prompt = 'Please hit enter to add a temporary configuration:';
}
$this->out();
$name = $this->in($prompt, [
'choices' => array_keys($configs),
'default' => 'temporary'
]);
if ($name == 'temporary') {
foreach ($options as $option => $default) {
$configs[$name][$option] = $this->in(ucfirst($option) . ':', compact('default'));
}
Catalog::config($configs);
}
return $name;
}