You are here

protected function SearchApiFulltext::valueForm in Search API 8

Adds a form for entering the value or values for the filter.

Overridden to remove fields that won't be used (but aren't hidden either because of a small bug/glitch in the original form code – see #2637674).

Parameters

array $form: The form array, passed by reference.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides SearchApiFilterTrait::valueForm

See also

\Drupal\views\Plugin\views\filter\FilterPluginBase::valueForm()

File

src/Plugin/views/filter/SearchApiFulltext.php, line 281

Class

SearchApiFulltext
Defines a filter for adding a fulltext search to the view.

Namespace

Drupal\search_api\Plugin\views\filter

Code

protected function valueForm(&$form, FormStateInterface $form_state) {
  parent::valueForm($form, $form_state);
  $form['value'] = [
    '#type' => 'textfield',
    '#title' => !$form_state
      ->get('exposed') ? $this
      ->t('Value') : '',
    '#size' => 30,
    '#default_value' => $this->value,
  ];
  if (!empty($this->options['expose']['placeholder'])) {
    $form['value']['#attributes']['placeholder'] = $this->options['expose']['placeholder'];
  }
}