You are here

public static function FieldNote::propertyDefinitions in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 field_permission_example/src/Plugin/Field/FieldType/FieldNote.php \Drupal\field_permission_example\Plugin\Field\FieldType\FieldNote::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

modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php, line 49

Class

FieldNote
Plugin implementation of the 'field_permission_example' field type.

Namespace

Drupal\field_permission_example\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['value'] = DataDefinition::create('string')
    ->setLabel(t('Field Note'));
  return $properties;
}