// Make sure that revisionable and translatable entity types are correctly
// defined.
if ($entity_type->
isRevisionable() &&
$entity_type->
isTranslatable()) { // The 'revision_translation_affected' field should always be defined.
// This field has been added unconditionally in Drupal 8.4.0 and it is
// overriding any pre-existing definition on purpose so that any
// differences are immediately available in the status report.
$base_field_definitions[$keys['revision_translation_affected'
]] = BaseFieldDefinition::
create('boolean'
) ->
setLabel($this->
t('Revision translation affected'
)) ->
setDescription($this->
t('Indicates if the last edit of a translation belongs to current revision.'
)) ->
setReadOnly(TRUE
) ->
setRevisionable(TRUE
) ->
setTranslatable(TRUE
);
} // Assign base field definitions the entity type provider.
$provider =
$entity_type->
getProvider();
foreach ($base_field_definitions as $definition) { // @todo Remove this check once FieldDefinitionInterface exposes a proper
// provider setter. See https://www.drupal.org/node/2225961.
if ($definition instanceof BaseFieldDefinition
) { $definition->
setProvider($provider);
}