Commit cbb6dd0c authored by Jon Pugh's avatar Jon Pugh

If "platform" option is specified when creating a site, load those options as the defaults.

parent f2cf9997
......@@ -183,6 +183,26 @@ class SaveCommand extends Command
exit(1);
}
// Pass platform options into Site Options
if ($this->context_type == 'site') {
if ($input->getOption('platform') && $platform = $this->getProvision()->getContext($input->getOption('platform'))) {
foreach ($platform->getProperties() as $name => $value) {
if ($name != 'name' && $name != 'type' && $this->input->hasOption($name)) {
$this->getProvision()->getLogger()->notice("Setting option '{name}' from platform to '{value}'.", [
'name' => $name,
'value' => $value,
]);
// If the symfony console option is an empty string, it
if (empty($value)) {
$value = FALSE;
}
$this->input->setOption($name, $value);
}
}
}
}
$options = $this->askForContextProperties();
$options['name'] = $this->context_name;
$options['type'] = $this->context_type;
......@@ -359,8 +379,8 @@ class SaveCommand extends Command
$property->default = $current_value;
}
// If option does not exist, ask for it.
if (!empty($this->input->getOption($name))) {
// If option does not exist, ask for it. option is FALSE if loaded from platform with empty property. Prevents console from asking for it if empty.
if (!empty($this->input->getOption($name)) || $this->input->getOption($name) === FALSE) {
$properties[$name] = $this->input->getOption($name);
$this->io->comment("Using option {$name}={$properties[$name]}");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment