function FilterTest::buildOptionsForm

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php \Drupal\views_test_data\Plugin\views\filter\FilterTest::buildOptionsForm()
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php \Drupal\views_test_data\Plugin\views\filter\FilterTest::buildOptionsForm()
  3. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php \Drupal\views_test_data\Plugin\views\filter\FilterTest::buildOptionsForm()

Provide the basic form which calls through to subforms.

If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.

Parameters

array $form: An alterable, associative array containing the structure of the form, passed by reference.

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

Overrides FilterPluginBase::buildOptionsForm

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php, line 27

Class

FilterTest
#[ViewsFilter("test_filter")]

Namespace

Drupal\views_test_data\Plugin\views\filter

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['test_enable'] = [
    '#type' => 'checkbox',
    '#title' => $this->t('Controls whether the filter plugin should be active'),
    '#default_value' => $this->options['test_enable'],
  ];
}

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