You are here

public static function TextWithTitle::propertyDefinitions in Text with Title Field 8

Field type properties definition.

Inside this method we defines all the fields (properties) that our custom field type will have.

Here there is a list of allowed property types: https://goo.gl/sIBBgO

Overrides FieldItemInterface::propertyDefinitions

File

src/Plugin/Field/FieldType/TextWithTitle.php, line 32

Class

TextWithTitle
Plugin implementation of the 'Text Title' field type.

Namespace

Drupal\text_with_title\Plugin\Field\FieldType

Code

public static function propertyDefinitions(StorageDefinition $storage) {
  $properties = [];
  $properties['title'] = DataDefinition::create('string')
    ->setLabel(t('Title'));
  $properties['text'] = MapDataDefinition::create()
    ->setLabel(t('Text'));
  return $properties;
}