You are here

function taxonomy_dupecheck_form in Taxonomy dupecheck 7

Form builder; creates and displays the Taxonomy dupecheck configuration settings form.

1 string reference to 'taxonomy_dupecheck_form'
taxonomy_dupecheck_menu in ./taxonomy_dupecheck.module
Implements hook_menu().

File

./taxonomy_dupecheck.module, line 41
Module file for the Taxonomy dupecheck module.

Code

function taxonomy_dupecheck_form($form, &$form_state) {

  // Checkboxes to choose what should be checked for dupes (vocab, terms, both)
  $form['taxonomy_dupecheck_types'] = array(
    '#type' => 'checkboxes',
    '#title' => 'Check for duplicate',
    '#default_value' => variable_get('taxonomy_dupecheck_types', array()),
    '#options' => array(
      'vocab' => t('Vocabularies'),
      'term' => t('Terms (within a vocabulary)'),
    ),
  );
  $vocabs = taxonomy_get_vocabularies();
  $options = array();
  foreach ($vocabs as $v) {
    $options[$v->vid] = $v->name;
  }
  $form['taxonomy_dupecheck_vocabularies'] = array(
    '#type' => 'checkboxes',
    '#title' => 'Limit term check on specific vocabularies',
    '#default_value' => variable_get('taxonomy_dupecheck_vocabularies', array()),
    '#options' => $options,
    '#description' => t('If no option is selected, all terms will be checked for duplicates.'),
  );

  // Checkbox to indicate whether the check should be case-sensitive
  $form['taxonomy_dupecheck_case_sensitive'] = array(
    '#type' => 'checkbox',
    '#title' => "Case-sensitive comparison (e.g. 'Foo' and 'foo' are not duplicates if checked).",
    '#default_value' => variable_get('taxonomy_dupecheck_case_sensitive'),
  );
  return system_settings_form($form);
}