public static function ComplexGrouping::complexGroupingValidate in Views Complex Grouping 8
Validate Complex Grouping form options.
File
- src/
Plugin/ views/ style/ ComplexGrouping.php, line 291
Class
- ComplexGrouping
- Class ComplexGrouping.
Namespace
Drupal\views_complex_grouping\Plugin\views\styleCode
public static function complexGroupingValidate($element, FormStateInterface $form_state, $form) {
if (!is_numeric($element['#value'])) {
$form_state
->setError($element, t('%element must be numeric.', [
'%element' => $element['#title'],
]));
}
// Checking for negative val ues.
if ($element['#value'] < 0) {
$form_state
->setError($element, t('%element cannot be negative.', [
'%element' => $element['#title'],
]));
}
}