You are here

function views_natural_sort_settings_form in Views Natural Sort 7.2

Same name and namespace in other branches
  1. 6 views_natural_sort.admin.inc \views_natural_sort_settings_form()
  2. 7 views_natural_sort.admin.inc \views_natural_sort_settings_form()

Form callback for the Views Natural Sort settings page.

Allows the removal of specific words and symbols from all your titles.

1 string reference to 'views_natural_sort_settings_form'
views_natural_sort_settings_page in ./views_natural_sort.admin.inc
Views Natural Sort Admin Settings Page callback.

File

./views_natural_sort.admin.inc, line 50
Callbacks for managing Views Natural Sort.

Code

function views_natural_sort_settings_form() {
  $form = array();
  $form['beginning_words'] = array(
    '#type' => 'textfield',
    '#title' => 'Words to filter from the beginning of a phrase',
    '#default_value' => implode(',', variable_get('views_natural_sort_beginning_words_remove', array())),
    '#description' => t('Commonly, the words "A", "The", and "An" are removed when sorting book titles if they appear at the beginning of the title. Those would be great candidates for this field. Separate words with a comma.'),
  );
  $form['words'] = array(
    '#type' => 'textfield',
    '#title' => 'Words to filter from anywhere in a phrase',
    '#default_value' => implode(',', variable_get('views_natural_sort_words_remove', array())),
    '#description' => t('Commonly used words like "of", "and", and "or" are removed when sorting book titles. Words you would like filtered go here. Separate words with a comma.'),
  );
  $form['symbols'] = array(
    '#type' => 'textfield',
    '#title' => 'Symbols to filter from anywhere in a phrase',
    '#default_value' => variable_get('views_natural_sort_symbols_remove', ''),
    '#description' => t('Most symbols are ignored when performing a sort naturally. Those symbols you want ignored go here. Do not use a separator. EX: &$".'),
  );
  $form['days_of_the_week_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => 'Sort days of the week and their abbreviations',
    '#description' => "Checking this setting will allow sorting of days of the week in their proper order starting with the day of the week that is configurable by you and for each language.",
    '#efault_value' => variable_get('views_natural_sort_days_of_the_week_enabled', FALSE),
  );
  $form['batch_items'] = array(
    '#type' => 'textfield',
    '#title' => 'Items per Batch',
    '#default_value' => variable_get('views_natural_sort_rebuild_items_per_batch', '500'),
    '#description' => t('The number of items a batch process will work through at a given time. Raising this number will make the batch go quicker, however, raising it too high can cause timeouts and/or memory limit errors.'),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save Settings'),
  );
  return $form;
}