public static function WebformYaml::validate in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Utility/WebformYaml.php \Drupal\webform\Utility\WebformYaml::validate()
Validate YAML string.
Parameters
string $yaml: A YAML string.
Return value
null|string NULL if the YAML string contains no errors, else the parsing exception message is returned.
2 calls to WebformYaml::validate()
- WebformTranslationManager::getElements in src/
WebformTranslationManager.php - Get webform elements for specific language.
- WebformYaml::isValid in src/
Utility/ WebformYaml.php - Determine if string is valid YAML.
File
- src/
Utility/ WebformYaml.php, line 76
Class
- WebformYaml
- Provides YAML tidy function.
Namespace
Drupal\webform\UtilityCode
public static function validate($yaml) {
try {
Yaml::decode($yaml);
return NULL;
} catch (\Exception $exception) {
return $exception
->getMessage();
}
}