function FilterBooleanOperatorTest::getGroupedExposedFilters

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::getGroupedExposedFilters()
  2. 10 core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::getGroupedExposedFilters()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php \Drupal\Tests\views\Kernel\Handler\FilterBooleanOperatorTest::getGroupedExposedFilters()

Provides grouped exposed filter configuration.

Return value

array

1 call to FilterBooleanOperatorTest::getGroupedExposedFilters()
FilterBooleanOperatorTest::testFilterGroupedExposed in core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
Tests the boolean filter with grouped exposed form enabled.

File

core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php, line 174

Class

FilterBooleanOperatorTest
Tests the core Drupal\views\Plugin\views\filter\BooleanOperator handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function getGroupedExposedFilters() {
    $filters = [
        'status' => [
            'id' => 'status',
            'table' => 'views_test_data',
            'field' => 'status',
            'relationship' => 'none',
            'exposed' => TRUE,
            'expose' => [
                'operator' => 'status_op',
                'label' => 'status',
                'identifier' => 'status',
            ],
            'is_grouped' => TRUE,
            'group_info' => [
                'label' => 'status',
                'identifier' => 'status',
                'default_group' => 'All',
                'group_items' => [
                    1 => [
                        'title' => 'Active',
                        'operator' => '=',
                        'value' => '1',
                    ],
                    2 => [
                        'title' => 'Blocked',
                        'operator' => '=',
                        'value' => '0',
                    ],
                    // This group should return the same results as group 1, because it
                    // is the negation of group 2.
3 => [
                        'title' => 'Active (reverse)',
                        'operator' => '!=',
                        'value' => '0',
                    ],
                ],
            ],
        ],
    ];
    return $filters;
}

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