X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FEntityFieldManager.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FEntityFieldManager.php;h=63c35e9743b3e63ea32eb0dfbbb0d046a25425ab;hp=378a95ca94907dc7cbb0206b802d0e9b1fe17274;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php b/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php index 378a95ca9..63c35e974 100644 --- a/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php +++ b/web/core/lib/Drupal/Core/Entity/EntityFieldManager.php @@ -60,7 +60,7 @@ class EntityFieldManager implements EntityFieldManagerInterface { * - type: The field type. * - bundles: The bundles in which the field appears. * - * @return array + * @var array */ protected $fieldMap = []; @@ -220,6 +220,20 @@ class EntityFieldManager implements EntityFieldManagerInterface { } } + // Make sure that revisionable 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) { @@ -332,7 +346,7 @@ class EntityFieldManager implements EntityFieldManagerInterface { // Load base field overrides from configuration. These take precedence over // base field overrides returned above. - $base_field_override_ids = array_map(function($field_name) use ($entity_type_id, $bundle) { + $base_field_override_ids = array_map(function ($field_name) use ($entity_type_id, $bundle) { return $entity_type_id . '.' . $bundle . '.' . $field_name; }, array_keys($base_field_definitions)); $base_field_overrides = $this->entityTypeManager->getStorage('base_field_override')->loadMultiple($base_field_override_ids);