You are here

public function FilterPluginBase::buildOptionsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::buildOptionsForm()
  2. 9 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::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.

1 call to FilterPluginBase::buildOptionsForm()
Combine::buildOptionsForm in core/modules/views/src/Plugin/views/filter/Combine.php
Provide the basic form which calls through to subforms.
2 methods override FilterPluginBase::buildOptionsForm()
Combine::buildOptionsForm in core/modules/views/src/Plugin/views/filter/Combine.php
Provide the basic form which calls through to subforms.
FilterTest::buildOptionsForm in core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php
Overrides Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 209

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  if ($this
    ->canExpose()) {
    $this
      ->showExposeButton($form, $form_state);
  }
  if ($this
    ->canBuildGroup()) {
    $this
      ->showBuildGroupButton($form, $form_state);
  }
  $form['clear_markup_start'] = [
    '#markup' => '<div class="clearfix">',
  ];
  if ($this
    ->isAGroup()) {
    if ($this
      ->canBuildGroup()) {
      $form['clear_markup_start'] = [
        '#markup' => '<div class="clearfix">',
      ];

      // Render the build group form.
      $this
        ->showBuildGroupForm($form, $form_state);
      $form['clear_markup_end'] = [
        '#markup' => '</div>',
      ];
    }
  }
  else {

    // Add the subform from operatorForm().
    $this
      ->showOperatorForm($form, $form_state);

    // Add the subform from valueForm().
    $this
      ->showValueForm($form, $form_state);
    $form['clear_markup_end'] = [
      '#markup' => '</div>',
    ];
    if ($this
      ->canExpose()) {

      // Add the subform from buildExposeForm().
      $this
        ->showExposeForm($form, $form_state);
    }
  }
}