public function DisplayTest::validateOptionsForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest::validateOptionsForm()
- 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php \Drupal\views_test_data\Plugin\views\display\DisplayTest::validateOptionsForm()
File
- core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ display/ DisplayTest.php, line 92
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;
}
}