You are here

public static function SocialPost::baseFieldDefinitions in Social Post 8.2

Same name and namespace in other branches
  1. 3.x src/Entity/SocialPost.php \Drupal\social_post\Entity\SocialPost::baseFieldDefinitions()

Creating fields.

Overrides ContentEntityBase::baseFieldDefinitions

File

src/Entity/SocialPost.php, line 102

Class

SocialPost
Defines the Social Post entity.

Namespace

Drupal\social_post\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields['id'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('ID'))
    ->setDescription(t('The ID of the Social Post record.'))
    ->setReadOnly(TRUE)
    ->setSetting('unsigned', TRUE);
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The Social Post user UUID.'))
    ->setReadOnly(TRUE);

  // The Drupal user ID associated to the record.
  $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('User ID'))
    ->setDescription(t('The Drupal user ID associated to the record.'));

  // The implementer used to register the user.
  $fields['plugin_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Plugin ID'))
    ->setDescription(t('The implementer used to register the user.'));

  // Unique Account ID returned by provider.
  $fields['provider_user_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Provider User ID'))
    ->setDescription(t('The unique user ID in the provider.'));

  // User's name in the provider.
  $fields['name'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Name'))
    ->setDescription(t("User's name in the provider"));

  // Access token returned by provider, used for autoposting.
  $fields['token'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Token'))
    ->setDescription(t('Token returned after authentication'));

  // Additional data about the user.
  $fields['additional_data'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Additional Data'))
    ->setDescription(t('Additional data about the user'));

  // Link to the user's profile in the provider.
  $fields['link'] = BaseFieldDefinition::create('link')
    ->setLabel(t('Link'))
    ->setDescription(t("Link to the user's profile in the provider."));
  return $fields;
}