public ContentTranslationHandler::getFieldDefinitions()
Returns a set of field definitions to be used to store metadata items.
Return value
\Drupal\Core\Field\FieldDefinitionInterface[]
Overrides ContentTranslationHandlerInterface::getFieldDefinitions
File
- core/modules/content_translation/src/ContentTranslationHandler.php, line 110
Class
- ContentTranslationHandler
- Base class for content translation handlers.
Namespace
Drupal\content_translation
Code
public function getFieldDefinitions() { $definitions = array(); $definitions['content_translation_source'] = BaseFieldDefinition::create('language') ->setLabel(t('Translation source')) ->setDescription(t('The source language from which this translation was created.')) ->setDefaultValue(LanguageInterface::LANGCODE_NOT_SPECIFIED) ->setRevisionable(TRUE) ->setTranslatable(TRUE); $definitions['content_translation_outdated'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Translation outdated')) ->setDescription(t('A boolean indicating whether this translation needs to be updated.')) ->setDefaultValue(FALSE) ->setRevisionable(TRUE) ->setTranslatable(TRUE); if (!$this->hasAuthor()) { $definitions['content_translation_uid'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Translation author')) ->setDescription(t('The author of this translation.')) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') ->setRevisionable(TRUE) ->setDefaultValueCallback(get_class($this) . '::getDefaultOwnerId') ->setTranslatable(TRUE); } if (!$this->hasPublishedStatus()) { $definitions['content_translation_status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Translation status')) ->setDescription(t('A boolean indicating whether the translation is visible to non-translators.')) ->setDefaultValue(TRUE) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } if (!$this->hasCreatedTime()) { $definitions['content_translation_created'] = BaseFieldDefinition::create('created') ->setLabel(t('Translation created time')) ->setDescription(t('The Unix timestamp when the translation was created.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } if (!$this->hasChangedTime()) { $definitions['content_translation_changed'] = BaseFieldDefinition::create('changed') ->setLabel(t('Translation changed time')) ->setDescription(t('The Unix timestamp when the translation was most recently saved.')) ->setRevisionable(TRUE) ->setTranslatable(TRUE); } return $definitions; }
Please login to continue.