protected function YamlFormEntityElementsValidator::validateYaml in YAML Form 8
Validate elements is validate YAML.
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup|null If not valid an error message.
1 call to YamlFormEntityElementsValidator::validateYaml()
- YamlFormEntityElementsValidator::validate in src/
YamlFormEntityElementsValidator.php - Validate form elements.
File
- src/
YamlFormEntityElementsValidator.php, line 131
Class
- YamlFormEntityElementsValidator
- Defines a class to validate form elements.
Namespace
Drupal\yamlformCode
protected function validateYaml() {
try {
Yaml::decode($this->elementsRaw);
return NULL;
} catch (\Exception $exception) {
return $this
->t('Elements are not valid. @message', [
'@message' => $exception
->getMessage(),
]);
}
}