private function GranularityStringConstraintValidator::isGranularityString in Duration Field 3.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/Validation/Constraint/GranularityStringConstraintValidator.php \Drupal\duration_field\Plugin\Validation\Constraint\GranularityStringConstraintValidator::isGranularityString()
Check if a string is a valid granularity string.
Parameters
mixed $value: The item to check as a granularity string.
Return value
bool TRUE if the given value is a valid granularity string. FALSE if it is not.
1 call to GranularityStringConstraintValidator::isGranularityString()
- GranularityStringConstraintValidator::validate in src/
Plugin/ Validation/ Constraint/ GranularityStringConstraintValidator.php
File
- src/
Plugin/ Validation/ Constraint/ GranularityStringConstraintValidator.php, line 44
Class
- GranularityStringConstraintValidator
- Validates the granularity_string constraint.
Namespace
Drupal\duration_field\Plugin\Validation\ConstraintCode
private function isGranularityString($value) {
if (is_string($value)) {
return preg_match(GraularityStringInterface::GRANULARITY_STRING_PATTERN, $value);
}
return FALSE;
}