You are here

function fieldset_helper_admin_settings in Fieldset helper 6

Same name and namespace in other branches
  1. 6.2 fieldset_helper.admin.inc \fieldset_helper_admin_settings()
  2. 7.2 fieldset_helper.admin.inc \fieldset_helper_admin_settings()

Administration page for the 'Fieldset helper' module.

1 string reference to 'fieldset_helper_admin_settings'
fieldset_helper_menu in ./fieldset_helper.module
Implementation of hook_menu().

File

./fieldset_helper.admin.inc, line 11
Administration page for the 'Fieldset helper' module.

Code

function fieldset_helper_admin_settings() {
  if (!FORM_HELPER_FIELDSET_PHPTEMPLATE_LOADED) {
    drupal_set_message(t("This module attempted to override the 'phptemplate_fieldset' and 'theme_system_modules' the functions but they already been defined.") . t('Please review the <a href="@read_me">README.txt</a> for more information on how to resolve this issue.', array(
      '@readme' => drupal_get_path('module', 'fieldset_helper') . '/README.txt',
    )), 'error');
  }

  // Auto excluded
  $form['auto_exclude'] = array(
    '#type' => 'fieldset',
    '#title' => t('Automatically excluded forms'),
    '#description' => t("The 'Fieldset helper' module automatically collects a list of any form, by id, that does not have any collapsible fieldsets.") . ' ' . t("These forms are then ignored by this module's hook_form_alter() code, which insures that this module's code is only executed on forms with collapsible fieldsets.") . ' ' . t("If a currently excluded form now has a collapsible fieldset you should clear the excluded forms list below."),
  );
  $form['auto_exclude']['clear_auto_exclude'] = array(
    '#type' => 'submit',
    '#value' => t('Clear automatically excluded forms'),
    '#submit' => array(
      'fieldset_helper_clear_auto_excluded_submit',
    ),
  );
  $auto_exclude = variable_get('fieldset_helper_auto_exclude', array());
  if ($auto_exclude) {
    $value = '<div><ul><li>' . implode('</li><li>', array_keys($auto_exclude)) . '</li></ul></div>';
  }
  else {
    $value = '<div>' . t('There are no excluded forms.') . '</div>';
  }
  $form['auto_exclude']['forms'] = array(
    '#type' => 'fieldset',
    '#title' => t('Automatically excluded forms by id'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#value' => $value,
  );

  // Clear fieldset id lookup
  $form['fieldset_id_lookup_ids'] = array(
    '#type' => 'fieldset',
    '#title' => t('Clear fieldset lookup ids'),
    '#description' => t("The 'Fieldset helper' module creates a lookup table for all the collapsible fieldset ids discovered on your website.") . ' ' . t("Clearing this list will affect the saved collapsible fieldset states for any user who is currently logged in.") . ' ' . t("This list should only need to be cleared if a larger number of forms and/or fieldsets on your website have been modified."),
  );
  $form['fieldset_id_lookup_ids']['clear_fieldset_id_lookup'] = array(
    '#type' => 'submit',
    '#value' => t('Clear fieldset lookup ids'),
    '#submit' => array(
      'fieldset_helper_clear_fieldset_id_lookup_submit',
    ),
  );

  // Cookie duration
  $form['fieldset_helper_cookie_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Cookie duration'),
    '#description' => t("The 'Fieldset helper' module saves the current fieldset state in a client-side browser cookie.") . ' ' . t("By default, this is a session cookie which is cleared when the user closes the browser.") . ' ' . t("Changing the 'Cookie duration' to a non-zero number makes the cookie persist even after the browser is closed and restarted."),
  );
  $form['fieldset_helper_cookie_settings']['fieldset_helper_cookie_duration'] = array(
    '#type' => 'textfield',
    '#title' => t('Cookie duration'),
    '#default_value' => variable_get('fieldset_helper_cookie_duration', 0),
    '#size' => 5,
    '#maxlength' => 5,
    '#description' => t("For how many days should the cookie persist after the client browser is closed?"),
    '#field_suffix' => t('days'),
  );
  return system_settings_form($form);
}