public function OperatorBase::validate in ThemeKey 8
Validate.
Overrides OperatorInterface::validate
File
- src/
OperatorBase.php, line 27 - Provides Drupal\themekey\OperatorBase.
Class
Namespace
Drupal\themekeyCode
public function validate(PropertyAdminInterface $propertyAdmin, $value, FormStateInterface $form_state) {
if ($possibleValues = $propertyAdmin
->getPossibleValues()) {
if (!in_array($value, $possibleValues)) {
$form_state
->setErrorByName('value', $this
->t('Value needs to be one of %values', implode(', ', $possibleValues)));
}
}
}