You are here

public function LingotekContentTranslationHandler::getFieldDefinitions in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  2. 4.0.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  3. 3.0.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  4. 3.1.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  5. 3.2.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  6. 3.3.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  7. 3.4.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  8. 3.5.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  9. 3.6.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  10. 3.7.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()
  11. 3.8.x src/LingotekContentTranslationHandler.php \Drupal\lingotek\LingotekContentTranslationHandler::getFieldDefinitions()

Overrides LingotekContentTranslationHandlerInterface::getFieldDefinitions

File

src/LingotekContentTranslationHandler.php, line 84
Contains \Drupal\content_translation\ContentTranslationHandler.

Class

LingotekContentTranslationHandler

Namespace

Drupal\lingotek

Code

public function getFieldDefinitions() {
  $definitions = array();
  $definitions['lingotek_document_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Lingotek document id'))
    ->setDescription(t('The Lingotek document id.'));
  $definitions['lingotek_hash'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Lingotek hash'))
    ->setDescription(t('A hash of the Lingotek saved entity data, required for checking for changes.'));
  $definitions['lingotek_profile'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Lingotek profile'))
    ->setDescription(t('The Lingotek profile defining this translation.'))
    ->setSetting('target_type', 'lingotek_profile');
  $definitions['lingotek_translation_source'] = BaseFieldDefinition::create('language')
    ->setLabel(t('Lingotek translation source'))
    ->setDescription(t('The source language from which this translation was created.'))
    ->setDefaultValue(LanguageInterface::LANGCODE_NOT_SPECIFIED)
    ->setTranslatable(TRUE);
  $definitions['lingotek_translation_status'] = BaseFieldDefinition::create('lingotek_language_key_value')
    ->setLabel(t('Lingotek translation status'))
    ->setDescription(t('The status of the source in case of being the source translation, or the status of the translation.'))
    ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
  if (!$this
    ->hasCreatedTime()) {
    $definitions['lingotek_translation_created'] = BaseFieldDefinition::create('created')
      ->setLabel(t('Lingotek translation created time'))
      ->setDescription(t('The Unix timestamp when the translation was created.'))
      ->setTranslatable(TRUE);
  }
  if (!$this
    ->hasChangedTime()) {
    $definitions['lingotek_translation_changed'] = BaseFieldDefinition::create('changed')
      ->setLabel(t('Translation changed time'))
      ->setDescription(t('The Unix timestamp when the translation was most recently saved.'))
      ->setTranslatable(TRUE);
  }
  return $definitions;
}