function environment_switch_environment_submit in Environment 6
Same name and namespace in other branches
- 7 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 - @file Settings for Environment module
File
- ./
environment.admin.inc, line 60 - 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_workflow_load($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'],
)));
}
}
}
}
}