public static function NameItem::propertyDefinitions in Name Field 8
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/ NameItem.php, line 96
Class
- NameItem
- Plugin implementation of the 'name' field type.
Namespace
Drupal\name\Plugin\Field\FieldTypeCode
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties = [];
$properties['title'] = DataDefinition::create('string')
->setLabel(t('Title'));
$properties['given'] = DataDefinition::create('string')
->setLabel(t('Given'));
$properties['middle'] = DataDefinition::create('string')
->setLabel(t('Middle name(s)'));
$properties['family'] = DataDefinition::create('string')
->setLabel(t('Family'));
$properties['generational'] = DataDefinition::create('string')
->setLabel(t('Generational'));
$properties['credentials'] = DataDefinition::create('string')
->setLabel(t('Credentials'));
return $properties;
}