function environment_admin_settings in Environment 6
Same name and namespace in other branches
- 7 environment.admin.inc \environment_admin_settings()
@file Settings for Environment module
1 string reference to 'environment_admin_settings'
- environment_menu in ./
environment.module - Implementation of hook_menu().
File
- ./
environment.admin.inc, line 8 - Settings for Environment module
Code
function environment_admin_settings() {
$form = array();
$env_override = variable_get('environment_override', NULL);
$env_current = environment_current(NULL);
if ($env_override) {
$form['environment'] = array(
'#type' => 'item',
'#title' => t('Current Environment'),
'#value' => $env_current,
);
$form['environment_override'] = array(
'#type' => 'item',
'#title' => t('Environment Override'),
'#value' => t('Active'),
);
}
else {
$form['environment'] = array(
'#title' => t('Environment state'),
'#type' => 'fieldset',
'#tree' => TRUE,
);
foreach (environment_workflow_load() as $name => $workflow) {
$default = isset($env_current[$name]) ? $env_current[$name] : '';
$form['environment'][$name] = array(
'#title' => t('@workflow environment workflow', array(
'@workflow' => $workflow['label'],
)),
'#description' => $workflow['description'],
'#type' => 'select',
'#options' => _environment_state_options($name),
'#default_value' => $default,
);
if (!$default) {
drupal_set_message(t('Not in a valid state for the @workflow workflow. Saving this form will put it into a valid state if one exists.', array(
'@workflow' => $workflow['label'],
)), 'warning');
}
}
}
$form['environment_require_override'] = array(
'#type' => 'checkbox',
'#title' => t('Require environment override'),
'#description' => t('Used to require that an environment is set in the settings.php file.'),
'#default_value' => variable_get('environment_require_override', FALSE),
);
$form['#submit'][] = 'environment_switch_environment_submit';
return system_settings_form($form);
}