You are here

public static function UserMentionsFieldType::propertyDefinitions in Tweet Feed 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldType/UserMentionsFieldType.php \Drupal\tweet_feed\Plugin\Field\FieldType\UserMentionsFieldType::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/UserMentionsFieldType.php, line 38

Class

UserMentionsFieldType
Plugin implementation of the 'user_mentions_field_type' field type.

Namespace

Drupal\tweet_feed\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {

  // Prevent early t() calls by using the TranslatableMarkup.
  $properties['mention_name'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('User Mentioned'))
    ->setDescription(new TranslatableMarkup('The name of a user mentioned in this tweet.'))
    ->setRequired(FALSE);
  $properties['mention_screen_name'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Screen Name'))
    ->setDescription(new TranslatableMarkup('The screen name name of a user mentioned in this tweet.'))
    ->setRequired(FALSE);
  $properties['mention_id'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('User Mentioned'))
    ->setDescription(new TranslatableMarkup('The internal Twttter ID  of a user mentioned in this tweet.'))
    ->setRequired(FALSE);
  return $properties;
}