You are here

function context_prefix_settings_form in Context 5

Settings form for choosing the operating mode of context_prefix

1 string reference to 'context_prefix_settings_form'
context_prefix_menu in context_prefix/context_prefix.module
Implementation of hook_menu().

File

context_prefix/context_prefix.module, line 449

Code

function context_prefix_settings_form() {
  global $base_url;
  $form = array();
  $options = _context_ui_options();
  foreach (context_prefix_providers() as $id => $provider) {

    // Check to see whether provider has limited the available prefixing methods
    if (is_array($provider['methods']) && count($provider['methods'])) {
      $provider_options = array();
      foreach ($provider['methods'] as $method) {
        $provider_options[$method] = $options[$method];
      }
    }
    else {
      $provider_options = $options;
    }
    $form[$id] = array(
      '#fieldset' => true,
      '#provider' => true,
      '#title' => $provider['name'],
      '#description' => $provider['description'],
    );
    $form[$id]['context_prefix_method_' . $id] = array(
      '#title' => t('Method'),
      '#type' => 'select',
      '#options' => $provider_options,
      '#default_value' => variable_get('context_prefix_method_' . $id, CONTEXT_PREFIX_PATH),
    );
    $form[$id]['context_prefix_method_' . $id . '_key'] = array(
      '#title' => t('Key'),
      '#type' => 'textfield',
      '#size' => 12,
      '#default_value' => variable_get('context_prefix_method_' . $id . '_key', ''),
    );
  }
  $form['context_prefix_location'] = array(
    '#type' => 'fieldset',
    '#title' => t('Prefix location settings'),
  );
  $form['context_prefix_location']['context_prefix_base_domain'] = array(
    '#type' => 'textfield',
    '#title' => t('Select base domain'),
    '#description' => t('This setting determines the base domain for domain based context prefixing.'),
    '#required' => FALSE,
    '#default_value' => variable_get('context_prefix_base_domain', $base_url),
  );
  $form = system_settings_form($form);
  $form['#theme'] = 'context_prefix_settings_form';
  return $form;
}