You are here

public static function BrightcoveVideo::baseFieldDefinitions in Brightcove Video Connect 8.2

Same name and namespace in other branches
  1. 8 src/Entity/BrightcoveVideo.php \Drupal\brightcove\Entity\BrightcoveVideo::baseFieldDefinitions()
  2. 3.x src/Entity/BrightcoveVideo.php \Drupal\brightcove\Entity\BrightcoveVideo::baseFieldDefinitions()

Provides base field definitions for an entity type.

Implementations typically use the class \Drupal\Core\Field\BaseFieldDefinition for creating the field definitions; for example a 'name' field could be defined as the following:

$fields['name'] = BaseFieldDefinition::create('string')
  ->setLabel(t('Name'));

By definition, base fields are fields that exist for every bundle. To provide definitions for fields that should only exist on some bundles, use \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions().

The definitions returned by this function can be overridden for all bundles by hook_entity_base_field_info_alter() or overridden on a per-bundle basis via 'base_field_override' configuration entities.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition. Useful when a single class is used for multiple, possibly dynamic entity types.

Return value

\Drupal\Core\Field\FieldDefinitionInterface[] An array of base field definitions for the entity type, keyed by field name.

Overrides ContentEntityBase::baseFieldDefinitions

See also

\Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()

\Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions()

File

src/Entity/BrightcoveVideo.php, line 947

Class

BrightcoveVideo
Defines the Brightcove Video entity.

Namespace

Drupal\brightcove\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

  // Set weights based on the real order of the fields.
  $weight = -30;

  /*
   * Drupal-specific fields first.
   *
   * bcvid - Brightcove Video ID (Drupal-internal).
   * uuid - UUID.
   * - Title comes here, but that's the "Name" field from Brightcove.
   * langcode - Language.
   * api_client - Entityreference to BrightcoveAPIClient.
   * - Brightcove fields come here.
   * uid - Author.
   * created - Posted.
   * changed - Last modified.
   */
  $fields['bcvid'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('ID'))
    ->setDescription(t('The Drupal entity ID of the Brightcove Video.'))
    ->setReadOnly(TRUE);
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The Brightcove Video UUID.'))
    ->setReadOnly(TRUE);
  $fields['api_client'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('API Client'))
    ->setDescription(t('Brightcove API credentials (account) to use.'))
    ->setRequired(TRUE)
    ->setSetting('target_type', 'brightcove_api_client')
    ->setDisplayOptions('form', [
    'type' => 'options_select',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['player'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Player'))
    ->setDescription(t('Brightcove Player to be used for playback.'))
    ->setSetting('target_type', 'brightcove_player')
    ->setDisplayOptions('form', [
    'type' => 'options_select',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // Status field, tied together with the status of the entity.
  $fields['status'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Enabled'))
    ->setDescription(t('Determines whether the video is playable.'))
    ->setDefaultValue(TRUE)
    ->setSettings([
    'on_label' => t('Active'),
    'off_label' => t('Inactive'),
  ])
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'label' => 'above',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'boolean',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['name'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Name'))
    ->setDescription(t('Title of the video.'))
    ->setRequired(TRUE)
    ->setSettings([
    // Not applying the max_length setting any longer. Without an explicit
    // max_length setting Drupal will use a varchar(255) field, at least on
    // my MySQL backend. BC docs currently say the length of the 'name'
    // field is 1..255, but let's just not apply any explicit limit any
    // longer on the Drupal end.
    'text_processing' => 0,
  ])
    ->setDisplayOptions('form', [
    'type' => 'string_textfield',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'string',
    'label' => 'hidden',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE);
  $fields['langcode'] = BaseFieldDefinition::create('language')
    ->setLabel(t('Language code'))
    ->setDescription(t('The language code for the Brightcove Video.'))
    ->setDisplayOptions('form', [
    'type' => 'language_select',
    'weight' => ++$weight,
  ])
    ->setDisplayConfigurable('form', TRUE);

  /*
   * Additional Brightcove fields, based on
   * @see https://videocloud.brightcove.com/admin/fields
   * superseded by
   * @see http://docs.brightcove.com/en/video-cloud/cms-api/references/cms-api/versions/v1/index.html#api-videoGroup-Get_Videos
   * superseded by
   * @see http://docs.brightcove.com/en/video-cloud/cms-api/references/cms-api/versions/v1/index.html#api-videoGroup-Create_Video
   *
   * Brightcove ID - string (Not editable. Unique Video ID assigned by
   *   Brightcove)
   * Economics - list (ECONOMICS_TYPE_FREE, ECONOMICS_TYPE_AD_SUPPORTED)
   * Force Ads - boolean
   * Geo-filtering Country List - list (ISO-3166 country code list)
   * Geo-filtering On - boolean
   * Geo-filtering Options - list (Include countries, Exclude Countries)
   * Logo Overlay Alignment - list (Top Left, Top Right, Bottom Right,
   *   Bottom Left)
   * Logo Overlay Image - image file (Transparent PNG or GIF)
   * Logo Overlay Tooltip - text(128)
   * Logo Overlay URL - URL(128)
   * Long Description - string(0..5000)
   * Bumper Video - video file (FLV or H264 video file to playback before the
   *   Video content)
   * Reference ID - string(..150) (Value specified must be unique)
   * Related Link Text - text(40)
   * Scheduling End Date - date (Day/Time for the video to be hidden in the
   *   player)
   * Scheduling Start Date - date (Day/Time for the video be displayed in the
   *   player)
   * Short Description - string(0..250)
   * Tags - text (Separate tags with a comma; no tag > 128 characters. Max
   *   1200 tags per video)
   * Thumbnail - image file (Suggested size: 120 x 90 pixels, JPG)
   * Video Duration - number (Not editable. Stores the length of the video
   *   file.)
   * Video Files - video file (One or more FLV or H264 video files)
   * Video Name - string(1..255)
   * Video Still - image file (Suggested size: 480 x 360 pixels, JPG)
   * Viral Distribution - boolean (Enables the get code and blogging menu
   *   options for the video)
   */
  $fields['video_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Video ID'))
    ->setDescription(t('Unique Video ID assigned by Brightcove.'))
    ->setReadOnly(TRUE)
    ->setDisplayOptions('view', [
    'type' => 'string',
    'label' => 'inline',
    'weight' => ++$weight,
  ])
    ->setDisplayConfigurable('view', TRUE);
  $fields['duration'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Video Duration'))
    ->setReadOnly(TRUE)
    ->setDisplayOptions('view', [
    'type' => 'number_time',
    'label' => 'inline',
    'weight' => ++$weight,
    'settings' => [
      'storage' => TimeFieldFormatter::STORAGE_MILLISECONDS,
      'display' => TimeFieldFormatter::DISPLAY_NUMBERSMS,
    ],
  ])
    ->setDisplayConfigurable('view', TRUE);
  $fields['description'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Short description'))
    ->setDescription(t('Max 250 characters.'))
    ->setDisplayOptions('form', [
    'type' => 'string_textarea',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'basic_string',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE)
    ->addPropertyConstraints('value', [
    'Length' => [
      'max' => 250,
    ],
  ]);
  $fields['tags'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Tags'))
    ->setDescription(t('Max 1200 tags per video'))
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
    ->setSettings([
    'target_type' => 'taxonomy_term',
    'handler_settings' => [
      'target_bundles' => [
        self::TAGS_VID => self::TAGS_VID,
      ],
      'auto_create' => TRUE,
    ],
  ])
    ->setDisplayOptions('form', [
    'type' => 'entity_reference_autocomplete',
    'weight' => ++$weight,
    'settings' => [
      'autocomplete_type' => 'tags',
    ],
  ])
    ->setDisplayOptions('view', [
    'type' => 'entity_reference_label',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['related_link'] = BaseFieldDefinition::create('link')
    ->setLabel(t('Related Link'))
    ->setSettings([
    'max_length' => 150,
    'link_type' => LinkItemInterface::LINK_GENERIC,
    'title' => DRUPAL_OPTIONAL,
  ])
    ->setDisplayOptions('form', [
    'type' => 'link_default',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'link',
    'label' => 'inline',
    'weight' => $weight,
    'settings' => [
      'trim_length' => 150,
      'target' => '_blank',
    ],
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['reference_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Reference ID'))
    ->addConstraint('UniqueField')
    ->setDescription(t('Value specified must be unique'))
    ->setSettings([
    'max_length' => 150,
    'text_processing' => 0,
  ])
    ->setDisplayOptions('form', [
    'type' => 'string_textfield',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'string',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDefaultValueCallback(static::class . '::getDefaultReferenceId')
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['long_description'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Long description'))
    ->setDescription(t('Max 5000 characters'))
    ->setDisplayOptions('form', [
    'type' => 'string_textarea',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'basic_string',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE)
    ->addPropertyConstraints('value', [
    'Length' => [
      'max' => 5000,
    ],
  ]);

  // Advertising field, but Brightcove calls it 'economics' in the API.
  $fields['economics'] = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Advertising'))
    ->setRequired(TRUE)
    ->setDefaultValue(self::ECONOMICS_TYPE_FREE)
    ->setSetting('allowed_values', [
    self::ECONOMICS_TYPE_FREE => 'Free',
    self::ECONOMICS_TYPE_AD_SUPPORTED => 'Ad Supported',
  ])
    ->setDisplayOptions('form', [
    'type' => 'options_buttons',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'string',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // @TODO: Folder
  $fields['video_file'] = BaseFieldDefinition::create('file')
    ->setLabel(t('Video source'))
    ->setSettings([
    'file_extensions' => '3gp 3g2 aac ac3 asf avchd avi avs bdav dv dxa ea eac3 f4v flac flv h261 h263 h264 m2p m2ts m4a m4v mjpeg mka mks mkv mov mp3 mp4 mpeg mpegts mpg mt2s mts ogg ps qt rtsp thd ts vc1 wav webm wma wmv',
    'file_directory' => '[random:hash:md5]',
  ])
    ->setDisplayOptions('form', [
    'type' => 'file_generic',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'file_url_plain',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // Provide an external URL.
  $fields['video_url'] = BaseFieldDefinition::create('uri')
    ->setLabel(t('Video source URL'))
    ->setDisplayOptions('form', [
    'type' => 'uri',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'uri_link',
    'label' => 'inline',
    'weight' => $weight,
    'settings' => [
      'trim_length' => 150,
      'target' => '_blank',
    ],
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['profile'] = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Encoding profile'))
    ->setRequired(TRUE)
    ->setSetting('allowed_values_function', [
    self::class,
    'profileAllowedValues',
  ])
    ->setDisplayOptions('form', [
    'type' => 'options_select',
    'weight' => ++$weight,
  ])
    ->setDisplayConfigurable('form', TRUE);
  $fields['poster'] = BaseFieldDefinition::create('image')
    ->setLabel(t('Video Still'))
    ->setSettings([
    'file_extensions' => 'jpg jpeg png',
    'file_directory' => self::VIDEOS_IMAGES_POSTERS_DIR,
    'alt_field' => FALSE,
    'alt_field_required' => FALSE,
  ])
    ->setDisplayOptions('form', [
    'type' => 'image_image',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'image',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['thumbnail'] = BaseFieldDefinition::create('image')
    ->setLabel(t('Thumbnail'))
    ->setSettings([
    'file_extensions' => 'jpg jpeg png',
    'file_directory' => self::VIDEOS_IMAGES_THUMBNAILS_DIR,
    'alt_field' => FALSE,
    'alt_field_required' => FALSE,
  ])
    ->setDisplayOptions('form', [
    'type' => 'image_image',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'image',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['custom_field_values'] = BaseFieldDefinition::create('map');
  $fields['schedule_starts_at'] = BaseFieldDefinition::create('datetime')
    ->setLabel(t('Scheduled Start Date'))
    ->setDescription(t('If not specified, the video will be Available Immediately.'))
    ->setDisplayOptions('form', [
    'type' => 'datetime_default',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'datetime_default',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['schedule_ends_at'] = BaseFieldDefinition::create('datetime')
    ->setLabel(t('Scheduled End Date'))
    ->setDescription(t('If not specified, the video will have No End Date.'))
    ->setDisplayOptions('form', [
    'type' => 'datetime_default',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'datetime_default',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['text_tracks'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Text Tracks'))
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
    ->setDescription(t('Referenced text tracks which belong to the video.'))
    ->setSetting('target_type', 'brightcove_text_track')
    ->setDisplayOptions('form', [
    'type' => 'brightcove_inline_entity_form_complex',
    'settings' => [
      'allow_new' => TRUE,
      'allow_existing' => FALSE,
    ],
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    'type' => 'entity_reference_label',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['uid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Authored by'))
    ->setDescription(t('The username of the Brightcove Video author.'))
    ->setTranslatable(TRUE)
    ->setDefaultValueCallback('Drupal\\brightcove\\Entity\\BrightcoveVideo::getCurrentUserId')
    ->setSetting('target_type', 'user')
    ->setDisplayOptions('form', [
    'type' => 'entity_reference_autocomplete',
    'weight' => ++$weight,
    'settings' => [
      'match_operator' => 'CONTAINS',
      'size' => '60',
      'autocomplete_type' => 'tags',
      'placeholder' => '',
    ],
  ])
    ->setDisplayOptions('view', [
    'type' => 'author',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['created'] = BaseFieldDefinition::create('created')
    ->setLabel(t('Created'))
    ->setDescription(t('The time that the Brightcove Video was created.'))
    ->setTranslatable(TRUE)
    ->setDisplayOptions('view', [
    'label' => 'inline',
    'type' => 'timestamp',
    'weight' => ++$weight,
  ])
    ->setDisplayConfigurable('view', TRUE);
  $fields['changed'] = BaseFieldDefinition::create('changed')
    ->setLabel(t('Changed'))
    ->setDescription(t('The time that the Brightcove Video was last edited.'))
    ->setTranslatable(TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['force_ads'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Force Ads'))
    ->setDefaultValue(FALSE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['geo_countries'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Geo-filtering Country List'))
    ->setDescription(t('ISO-3166 country code list.'))
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
    ->setSettings([
    'max_length' => 5,
    'text_processing' => 0,
  ])
    ->setDisplayOptions('form', [
    // Usable default type: string_textfield.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['geo_restricted'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Geo-filtering On'))
    ->setDefaultValue(FALSE)
    ->setDisplayOptions('form', [
    // Usable default type: boolean_checkbox.
    'type' => 'hidden',
    'weight' => ++$weight,
    'settings' => [
      'display_label' => TRUE,
    ],
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['geo_exclude_countries'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Geo-filtering Options: Exclude countries'))
    ->setDescription(t('If enabled, country list is treated as a list of countries excluded from viewing.'))
    ->setDisplayOptions('form', [
    // Usable default type: boolean_checkbox.
    'type' => 'hidden',
    'weight' => ++$weight,
    'settings' => [
      'display_label' => TRUE,
    ],
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['logo_alignment'] = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Logo Overlay Alignment'))
    ->setCardinality(4)
    ->setSetting('allowed_values', [
    'top_left' => 'Top Left',
    'top_right' => 'Top Right',
    'bottom_left' => 'Bottom Left',
    'bottom_right' => 'Bottom Right',
  ])
    ->setDisplayOptions('form', [
    // Usable default type: options_select.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['logo_image'] = BaseFieldDefinition::create('image')
    ->setLabel(t('Logo Overlay Image'))
    ->setSettings([
    'file_extensions' => 'png gif',
    'file_directory' => '[random:hash:md5]',
    'alt_field' => FALSE,
    'alt_field_required' => FALSE,
  ])
    ->setDisplayOptions('form', [
    // Usable default type: image_image.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: image.
    'type' => 'hidden',
    'label' => 'above',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['logo_tooltip'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Logo Overlay Tooltip'))
    ->setSettings([
    'max_length' => 128,
    'text_processing' => 0,
  ])
    ->setDisplayOptions('form', [
    // Usable default type: string_textfield.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $fields['logo_url'] = BaseFieldDefinition::create('link')
    ->setLabel(t('Logo Overlay URL'))
    ->setSettings([
    'max_length' => 128,
    'link_type' => LinkItemInterface::LINK_GENERIC,
    'title' => DRUPAL_DISABLED,
  ])
    ->setDisplayOptions('form', [
    // Usable default type: link_default.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: link.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
    'settings' => [
      'trim_length' => 128,
      'target' => '_blank',
    ],
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['bumper_video'] = BaseFieldDefinition::create('file')
    ->setLabel(t('Bumper Video'))
    ->setDescription(t('FLV or H264 video file to playback before the Video content'))
    ->setSettings([
    'file_extensions' => 'flv',
    'file_directory' => '[random:hash:md5]',
  ])
    ->setDisplayOptions('form', [
    // Usable default type: file_generic.
    'type' => 'hidden',
    'weight' => ++$weight,
  ])
    ->setDisplayOptions('view', [
    // Usable default type: file_url_plain.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Couldn't find this on the Brightcove UI: https://studio.brightcove.com/products/videocloud/media/videos/4585854207001
  $fields['viral'] = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Viral Distribution'))
    ->setDescription(t('Enables the get code and blogging menu options for the video'))
    ->setDefaultValue(FALSE)
    ->setDisplayOptions('form', [
    // Usable default type: boolean_checkbox.
    'type' => 'hidden',
    'weight' => ++$weight,
    'settings' => [
      'display_label' => TRUE,
    ],
  ])
    ->setDisplayOptions('view', [
    // Usable default type: string.
    'type' => 'hidden',
    'label' => 'inline',
    'weight' => $weight,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);

  // FIXME: Cue points?
  return $fields;
}