You are here

public function ViewsAutocompleteFiltersTrait::defineOptions in Views Autocomplete Filters 8

File

src/Plugin/views/filter/ViewsAutocompleteFiltersTrait.php, line 12

Class

ViewsAutocompleteFiltersTrait
Provides common methods for all Views Autocomplete Filters.

Namespace

Drupal\views_autocomplete_filters\Plugin\views\filter

Code

public function defineOptions() {
  $options = parent::defineOptions();
  $options['expose']['contains']['required'] = [
    'default' => FALSE,
    'bool' => TRUE,
  ];
  $options['expose']['contains'] += [
    'autocomplete_filter' => [
      'default' => 0,
    ],
    'autocomplete_min_chars' => [
      'default' => 0,
    ],
    'autocomplete_items' => [
      'default' => 10,
    ],
    'autocomplete_field' => [
      'default' => '',
    ],
    'autocomplete_raw_suggestion' => [
      'default' => TRUE,
    ],
    'autocomplete_raw_dropdown' => [
      'default' => TRUE,
    ],
    'autocomplete_dependent' => [
      'default' => FALSE,
    ],
  ];
  if (!$this
    ->hasAutocompleteFieldSelector()) {
    unset($options['expose']['contains']['autocomplete_field']);
  }
  return $options;
}