FilterTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
- 9 core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php
- 9 core/modules/views/tests/src/Functional/Plugin/FilterTest.php
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php
- 8.9.x core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
- 8.9.x core/modules/views/tests/src/Functional/Plugin/FilterTest.php
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php
- 11.x core/modules/jsonapi/tests/src/Kernel/Query/FilterTest.php
- 11.x core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FilterTest.php
- 11.x core/modules/views/tests/src/Functional/Plugin/FilterTest.php
- 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php
Namespace
Drupal\views_test_data\Plugin\views\filterFile
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ filter/ FilterTest.php
View source
<?php
namespace Drupal\views_test_data\Plugin\views\filter;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Attribute\ViewsFilter;
use Drupal\views\Plugin\views\filter\FilterPluginBase;
class FilterTest extends FilterPluginBase {
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::defineOptions().
*
* @return array
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['test_enable'] = [
'default' => TRUE,
];
return $options;
}
/**
* {@inheritdoc}
*/
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'],
];
}
/**
* {@inheritdoc}
*/
public function query() {
// Call the parent if this option is enabled.
if ($this->options['test_enable']) {
parent::query();
}
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
FilterTest |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.