You are here

function references_dialog_field_widget_settings_form in References dialog 7

Implements hook_field_widget_settings_form().

File

./references_dialog.module, line 853
This the main module file.

Code

function references_dialog_field_widget_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $defaults = field_info_widget_settings($widget['type']);
  $settings = array_merge($defaults, $widget['settings']);
  $form = array();
  if ($widget['type'] == 'references_dialog_term_reference') {
    $form['autocomplete_match'] = [
      '#type' => 'select',
      '#title' => t('Autocomplete matching'),
      '#default_value' => $settings['autocomplete_match'],
      '#options' => [
        'starts_with' => t('Starts with'),
        'contains' => t('Contains'),
      ],
      '#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of nodes.'),
    ];
    $form['size'] = [
      '#type' => 'textfield',
      '#title' => t('Size of textfield'),
      '#default_value' => $settings['size'],
      '#element_validate' => [
        '_element_validate_integer_positive',
      ],
      '#required' => TRUE,
    ];
  }
  return $form;
}