public static function MobileNumberItem::propertyDefinitions in Mobile Number 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldType/MobileNumberItem.php \Drupal\mobile_number\Plugin\Field\FieldType\MobileNumberItem::propertyDefinitions()
Defines field item properties.
Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().
Return value
\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.
Overrides FieldItemInterface::propertyDefinitions
See also
\Drupal\Core\Field\BaseFieldDefinition
File
- src/
Plugin/ Field/ FieldType/ MobileNumberItem.php, line 104
Class
- MobileNumberItem
- Plugin implementation of the 'mobile_number' field type.
Namespace
Drupal\mobile_number\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string')
->setLabel(t('E.165 Number'))
->addConstraint('Length', [
'max' => 19,
]);
$properties['country'] = DataDefinition::create('string')
->setLabel(t('Country Code'))
->addConstraint('Length', [
'max' => 3,
]);
$properties['local_number'] = DataDefinition::create('string')
->setLabel(t('National Number'))
->addConstraint('Length', [
'max' => 15,
]);
$properties['verified'] = DataDefinition::create('boolean')
->setLabel(t('Verified Status'));
$properties['tfa'] = DataDefinition::create('boolean')
->setLabel(t('TFA Option'));
return $properties;
}