function StylePluginBase::validateOptionsForm
Same name in other branches
- 8.9.x core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::validateOptionsForm()
- 10 core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::validateOptionsForm()
- 11.x core/modules/views/src/Plugin/views/style/StylePluginBase.php \Drupal\views\Plugin\views\style\StylePluginBase::validateOptionsForm()
Overrides PluginBase::validateOptionsForm
File
-
core/
modules/ views/ src/ Plugin/ views/ style/ StylePluginBase.php, line 367
Class
- StylePluginBase
- Base class for views style plugins.
Namespace
Drupal\views\Plugin\views\styleCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
// Don't run validation on style plugins without the grouping setting.
if ($form_state->hasValue([
'style_options',
'grouping',
])) {
// Don't save grouping if no field is specified.
$groupings = $form_state->getValue([
'style_options',
'grouping',
]);
foreach ($groupings as $index => $grouping) {
if (empty($grouping['field'])) {
$form_state->unsetValue([
'style_options',
'grouping',
$index,
]);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.