You are here

function habitat_ui_settings in Habitat 7

Page callback. Settings page.

1 string reference to 'habitat_ui_settings'
habitat_ui_menu in habitat_ui/habitat_ui.module
Implements hook_menu().

File

habitat_ui/habitat_ui.module, line 37
User Interface for Habitat.

Code

function habitat_ui_settings($form, $form_state) {
  $form['habitat_variable'] = array(
    '#type' => 'textfield',
    '#title' => t('Habitat variable name'),
    '#required' => TRUE,
    '#default_value' => variable_get('habitat_variable', 'fetcher_environment'),
    '#description' => t('The variable used in your settings.php files to indicate the habitat. This should be placed into settings.php like $conf[\'foo\'] = \'dev\'. Defaults to \'fetcher_environment\' which is added to settings.php when sites are built with the !fetcher system.', array(
      '!fetcher' => '<a href="http://drupal.org/project/fetcher">fetcher</a>',
    )),
  );
  $form['habitat_habitats'] = array(
    '#type' => 'textarea',
    '#title' => t('Habitats'),
    '#description' => t('The habitats to manage. Use machine_name conventions and enter one per line.'),
    '#required' => TRUE,
    '#default_value' => implode("\n", variable_get('habitat_habitats', array(
      'local',
      'dev',
      'test',
      'prod',
    ))),
  );
  $habitats = variable_get('habitat_habitats', array(
    'local',
    'dev',
    'test',
    'prod',
  ));
  foreach ($habitats as $habitat) {
    $form['habitat_enable_' . $habitat] = array(
      '#type' => 'textarea',
      '#title' => t('%habitat enabled modules', array(
        '%habitat' => $habitat,
      )),
      '#description' => t('The modules to force enable in this habitat. Use machine_name conventions and enter one per line.'),
      '#default_value' => implode("\n", variable_get('habitat_enable_' . $habitat, array())),
    );
    $form['habitat_disable_' . $habitat] = array(
      '#type' => 'textarea',
      '#title' => t('%habitat disabled modules', array(
        '%habitat' => $habitat,
      )),
      '#description' => t('The modules to force disable in this habitat. Use machine_name conventions and enter one per line.'),
      '#default_value' => implode("\n", variable_get('habitat_disable_' . $habitat, array())),
    );
  }
  $form['#submit'] = array(
    'habitat_ui_settings_submit',
  );
  return system_settings_form($form);
}