You are here

public function FilterPluginBase::addGroupForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::addGroupForm()

Add a new group to the exposed filter groups.

File

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

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

public function addGroupForm($form, FormStateInterface $form_state) {
  $item =& $this->options;

  // Add a new row.
  $item['group_info']['group_items'][] = [];
  $view = $form_state
    ->get('view');
  $display_id = $form_state
    ->get('display_id');
  $type = $form_state
    ->get('type');
  $id = $form_state
    ->get('id');
  $view
    ->getExecutable()
    ->setHandler($display_id, $type, $id, $item);
  $view
    ->cacheSet();
  $form_state
    ->set('rerender', TRUE);
  $form_state
    ->setRebuild();
  $form_state
    ->get('force_build_group_options', TRUE);
}