You are here

public static function SocialLinkItem::propertyDefinitions in Social Link 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/SocialLinkItem.php, line 26

Class

SocialLinkItem
Defines the 'social_links' entity field type.

Namespace

Drupal\social_link_field\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['social'] = DataDefinition::create('string')
    ->setLabel(t('Social network'))
    ->setRequired(FALSE);
  $properties['link'] = DataDefinition::create('string')
    ->setLabel(t('Profile link'))
    ->setRequired(FALSE);
  return $properties;
}