function DisplayTest::validateOptionsForm
Same name in other branches
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest::validateOptionsForm()
- 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest::validateOptionsForm()
- 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest::validateOptionsForm()
Overrides DisplayPluginBase::validateOptionsForm
File
-
core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ display/ DisplayTest.php, line 96
Class
- DisplayTest
- Defines a Display test plugin.
Namespace
Drupal\views_test_data\Plugin\views\displayCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
\Drupal::logger('views')->notice($form_state->getValue('test_option'));
switch ($form_state->get('section')) {
case 'test_option':
if (!trim($form_state->getValue('test_option'))) {
$form_state->setError($form['test_option'], $this->t('You cannot have an empty option.'));
}
break;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.