protected static function ListIntegerItem::validateAllowedValue in Drupal 8
Same name and namespace in other branches
- 9 core/modules/options/src/Plugin/Field/FieldType/ListIntegerItem.php \Drupal\options\Plugin\Field\FieldType\ListIntegerItem::validateAllowedValue()
Checks whether a candidate allowed value is valid.
Parameters
string $option: The option value entered by the user.
Return value
string The error message if the specified value is invalid, NULL otherwise.
Overrides ListItemBase::validateAllowedValue
File
- core/
modules/ options/ src/ Plugin/ Field/ FieldType/ ListIntegerItem.php, line 66
Class
- ListIntegerItem
- Plugin implementation of the 'list_integer' field type.
Namespace
Drupal\options\Plugin\Field\FieldTypeCode
protected static function validateAllowedValue($option) {
if (!preg_match('/^-?\\d+$/', $option)) {
return t('Allowed values list: keys must be integers.');
}
}