You are here

function synonyms_entity_base_field_info in Synonyms 8

Same name and namespace in other branches
  1. 2.0.x modules/synonyms_list_field/synonyms_list_field.module \synonyms_entity_base_field_info()

Implements hook_entity_base_field_info().

File

./synonyms.module, line 15
Provide synonyms feature for content entities.

Code

function synonyms_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type instanceof ContentEntityTypeInterface) {
    $fields = [];
    $fields['synonyms'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Entity synonyms'))
      ->setDescription(t('A list of known entity synonyms.'))
      ->setComputed(TRUE)
      ->setClass('\\Drupal\\synonyms\\Plugin\\SynonymsFieldItemList');
    return $fields;
  }
}