function ListFloatItem::validateAllowedValue

Same name in other branches
  1. 8.9.x core/modules/options/src/Plugin/Field/FieldType/ListFloatItem.php \Drupal\options\Plugin\Field\FieldType\ListFloatItem::validateAllowedValue()
  2. 10 core/modules/options/src/Plugin/Field/FieldType/ListFloatItem.php \Drupal\options\Plugin\Field\FieldType\ListFloatItem::validateAllowedValue()
  3. 11.x core/modules/options/src/Plugin/Field/FieldType/ListFloatItem.php \Drupal\options\Plugin\Field\FieldType\ListFloatItem::validateAllowedValue()

Overrides ListItemBase::validateAllowedValue

File

core/modules/options/src/Plugin/Field/FieldType/ListFloatItem.php, line 85

Class

ListFloatItem
Plugin implementation of the 'list_float' field type.

Namespace

Drupal\options\Plugin\Field\FieldType

Code

protected static function validateAllowedValue($option) {
    if (!is_numeric($option)) {
        return new TranslatableMarkup('Allowed values list: each key must be a valid integer or decimal.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.