You are here

function autocomplete_deluxe_field_widget_settings_form in Autocomplete Deluxe 7.2

Same name and namespace in other branches
  1. 7 autocomplete_deluxe.module \autocomplete_deluxe_field_widget_settings_form()

Implements hook_field_widget_settings_form().

File

./autocomplete_deluxe.module, line 174
Define enhanced autocomplete wdiget.

Code

function autocomplete_deluxe_field_widget_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $settings = $widget['settings'];
  $form['size'] = array(
    '#type' => 'textfield',
    '#title' => t('Size of textfield'),
    '#default_value' => isset($settings['size']) ? $settings['size'] : 6,
    '#element_validate' => array(
      '_element_validate_integer_positive',
    ),
    '#required' => TRUE,
  );
  $form['limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Limit of the output.'),
    '#description' => t('If set to zero no limit will be used'),
    '#default_value' => isset($settings['limit']) ? $settings['limit'] : 10,
    '#element_validate' => array(
      '_element_validate_integer',
    ),
  );
  $form['min_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum length.'),
    '#description' => t('The minimum length of characters to enter to open the suggestion list.'),
    '#default_value' => isset($settings['min_length']) ? $settings['min_length'] : 0,
    '#element_validate' => array(
      '_element_validate_integer',
    ),
  );
  $form['delimiter'] = array(
    '#type' => 'textfield',
    '#title' => t('Delimiter.'),
    '#description' => t('A character which should be used beside the enter key, to seperate terms.'),
    '#default_value' => isset($settings['delimiter']) ? $settings['delimiter'] : '',
    '#size' => 1,
  );
  $form['not_found_message'] = array(
    '#type' => 'textfield',
    '#title' => t('Term not found message.'),
    '#description' => t('A message text which will be displayed, if the entered term was not found.'),
    '#default_value' => isset($settings['not_found_message']) ? t($settings['not_found_message']) : t("The term '@term' will be added."),
  );
  $form['show_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show manage terms link'),
    '#description' => t('Should users be able to have direct access to manage terms for vocabulary of this field?'),
    '#default_value' => isset($settings['show_link']) ? $settings['show_link'] : '',
  );
  if (module_exists('synonyms')) {
    $form['use_synonyms'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow synonyms'),
      '#description' => t('Should users be able to search for synonyms of terms?'),
      '#default_value' => isset($settings['use_synonyms']) ? $settings['use_synonyms'] : FALSE,
    );
  }
  return $form;
}