function StringFilter::buildExposeForm

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/filter/StringFilter.php \Drupal\views\Plugin\views\filter\StringFilter::buildExposeForm()
  2. 10 core/modules/views/src/Plugin/views/filter/StringFilter.php \Drupal\views\Plugin\views\filter\StringFilter::buildExposeForm()
  3. 9 core/modules/views/src/Plugin/views/filter/StringFilter.php \Drupal\views\Plugin\views\filter\StringFilter::buildExposeForm()

Options form subform for exposed filter options.

Overrides FilterPluginBase::buildExposeForm

File

core/modules/views/src/Plugin/views/filter/StringFilter.php, line 84

Class

StringFilter
Basic textfield filter to handle string filtering commands including equality, like, not like, etc.

Namespace

Drupal\views\Plugin\views\filter

Code

public function buildExposeForm(&$form, FormStateInterface $form_state) {
  parent::buildExposeForm($form, $form_state);
  $form['expose']['placeholder'] = [
    '#type' => 'textfield',
    '#default_value' => $this->options['expose']['placeholder'],
    '#title' => $this->t('Placeholder'),
    '#size' => 40,
    '#description' => $this->t('Hint text that appears inside the field when empty.'),
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.