You are here

function ife_settings_form in Inline Form Errors 6

Same name and namespace in other branches
  1. 6.2 ife.settings.inc \ife_settings_form()
  2. 7.2 ife.settings.inc \ife_settings_form()
  3. 7 ife.settings.inc \ife_settings_form()

IFE settings form

1 string reference to 'ife_settings_form'
ife_menu in ./ife.module
Implementation of hook_menu().

File

./ife.settings.inc, line 13
Admin settings pages

Code

function ife_settings_form($form_state) {
  $form = array();

  //general options
  $form['general_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('General options'),
    '#collapsed' => FALSE,
    '#collapsible' => FALSE,
  );
  $form['general_settings']['ife_show_form_ids'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show form_ids on form'),
    '#description' => t('This option will print the form_id on the form for users with the administer inline form errors permissions'),
    '#default_value' => variable_get('ife_show_form_ids', 0),
  );
  $form['general_settings']['ife_display'] = array(
    '#type' => 'select',
    '#title' => t('Default display settings'),
    '#description' => t('What do you want to do with the original messages block at the top of the page?'),
    '#options' => array(
      t('Leave the messages in place (default Drupal behaviour)'),
      t('Show an alternate error message (a general error message of your choice)'),
      t('Remove all messages (Show nothing)'),
    ),
    '#default_value' => variable_get('ife_display', 1),
  );
  $form['general_settings']['ife_general_message'] = array(
    '#type' => 'textarea',
    '#title' => t('General error message'),
    '#description' => t('A general error message to display at the top of the page (default Drupal messages display). For use with the option "Show an alternate error message".'),
    '#default_value' => variable_get('ife_general_message', 'Please correct all highlighted errors and try again.'),
    '#required' => TRUE,
  );

  //the form id's
  $form['form_ids'] = array(
    '#type' => 'fieldset',
    '#title' => t('Form conversion'),
    '#collapsed' => FALSE,
    '#collapsible' => FALSE,
    '#tree' => TRUE,
    '#theme' => 'ife_settings_form_ids',
  );
  $form_ids = ife_load_form_ids();
  foreach ($form_ids as $form_id) {
    $form['form_ids'][$form_id->form_id] = array();
    $form['form_ids'][$form_id->form_id]['form_id'] = array(
      '#value' => $form_id->form_id,
    );
    $form['form_ids'][$form_id->form_id]['field_types'] = array(
      '#value' => t('All fields will be converted'),
    );
    $form['form_ids'][$form_id->form_id]['status'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enabled'),
      '#default_value' => $form_id->status,
    );
    $form['form_ids'][$form_id->form_id]['display'] = array(
      '#type' => 'select',
      '#options' => array(
        '-1' => t('<default>'),
        t('Leave the messages in place'),
        t('Show an alternate error message'),
        t('Remove all messages'),
      ),
      '#default_value' => $form_id->display,
    );
  }
  $form['form_ids']['new_form_id']['form_id'] = array(
    '#type' => 'textfield',
    '#size' => 20,
  );
  $form['form_ids']['new_form_id']['status'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enabled'),
    '#default_value' => 1,
  );
  $form['form_ids']['new_form_id']['field_types'] = array(
    '#value' => t('All fields will be converted'),
  );
  $form['form_ids']['new_form_id']['display'] = array(
    '#type' => 'select',
    '#options' => array(
      '-1' => t('<default>'),
      t('Leave the messages in place'),
      t('Show an alternate error messages'),
      t('Remove all message'),
    ),
    '#default_value' => -1,
  );

  //submit button
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  if (module_exists('i18n') && ($variables = variable_get('i18n_variables', 0))) {
    i18n_form_alter_settings($form, $variables);
  }
  return $form;
}