function environment_switch_environment_submit in Environment 7
Same name and namespace in other branches
- 6 environment.admin.inc \environment_switch_environment_submit()
Submit callback to switch environment if changed.
1 string reference to 'environment_switch_environment_submit'
- environment_admin_settings in ./
environment.admin.inc - Environment admin form.
File
- ./
environment.admin.inc, line 65 - Settings for Environment module.
Code
function environment_switch_environment_submit($form, &$form_state) {
if (!$form_state['values']['environment_require_override']) {
foreach (element_children($form['environment']) as $element) {
if ($form['environment'][$element]['#default_value'] != $form_state['values']['environment'][$element]) {
$result = environment_switch($form_state['values']['environment'][$element]);
if ($result) {
$original = environment_load($form['environment'][$element]['#default_value']);
$new = environment_load($form_state['values']['environment'][$element]);
$workflow = environment_load_workflow($element);
drupal_set_message(t("Successfully switched @workflow workflow from the '@original' to the '@new' environment.", array(
'@workflow' => $workflow['label'],
'@original' => $original['label'],
'@new' => $new['label'],
)));
}
}
}
}
}