You are here

function purl_settings_form in Persistent URL 6

Same name and namespace in other branches
  1. 7 purl.admin.inc \purl_settings_form()

Settings form for choosing the operating mode of purl

1 string reference to 'purl_settings_form'
purl_menu in ./purl.module
Implementation of hook_menu().

File

./purl.admin.inc, line 59
Admin pages for the purl module.

Code

function purl_settings_form() {
  $form = array();
  $options = _purl_options();
  foreach (purl_providers() as $id => $provider) {

    // Check to see whether provider has limited the available valueing methods
    if (isset($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]['purl_method_' . $id] = array(
      '#title' => t('Method'),
      '#type' => 'select',
      '#options' => $provider_options,
      '#default_value' => variable_get('purl_method_' . $id, 'path'),
    );

    // Allow processors to alter the form.
    foreach ($provider_options as $k => $v) {
      purl_get_processor($k)
        ->admin_form($form, $id);
    }
  }
  $form = system_settings_form($form);
  $form['#theme'] = 'purl_settings_form';
  return $form;
}