diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index dd3668d..9d0e5d6 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -275,6 +275,7 @@ public function setRevisionTranslationAffected($affected) { if ($this->hasField($field_name)) { $this->set($field_name, $affected); } + return $this; } /** @@ -1074,7 +1075,7 @@ public function hasTranslationChanges() { /** @var \Drupal\Core\Entity\ContentEntityBase $translation */ $translation = $original->getTranslation($this->activeLangcode); foreach ($this->getFieldDefinitions() as $field_name => $definition) { - // @todo Avoid special-casing the following field. See + // @todo Avoid special-casing the following fields. See // https://www.drupal.org/node/2329253. if ($field_name == 'revision_translation_affected' || $field_name == 'revision_id') { continue; diff --git a/core/lib/Drupal/Core/Entity/ContentEntityInterface.php b/core/lib/Drupal/Core/Entity/ContentEntityInterface.php index 8b20f55..3df7b40 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityInterface.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityInterface.php @@ -41,8 +41,11 @@ public function hasTranslationChanges(); /** * Marks the current revision translation as affected. * - * @param bool $affected - * The flag value. + * @param bool|null $affected + * The flag value. A NULL value can be specified to reset the current value + * and make sure a new value will be computed by the system. + * + * @return $this */ public function setRevisionTranslationAffected($affected); diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index 8e7dc6d..5623f75 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -152,13 +152,13 @@ function _content_translation_form_language_content_settings_form_alter(array &$ * @internal */ function _content_translation_is_field_translatability_configurable(EntityTypeInterface $entity_type, FieldStorageDefinitionInterface $definition) { -// Allow to configure only fields supporting multilingual storage. We skip our -// own fields as they are always translatable. Additionally we skip a set of -// well-known fields implementing entity system business logic. -return - $definition->isTranslatable() && - $definition->getProvider() != 'content_translation' && - !in_array($definition->getName(), [$entity_type->getKey('langcode'), $entity_type->getKey('default_langcode'), 'revision_translation_affected']); + // Allow to configure only fields supporting multilingual storage. We skip our + // own fields as they are always translatable. Additionally we skip a set of + // well-known fields implementing entity system business logic. + return + $definition->isTranslatable() && + $definition->getProvider() != 'content_translation' && + !in_array($definition->getName(), [$entity_type->getKey('langcode'), $entity_type->getKey('default_langcode'), 'revision_translation_affected']); } /** diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index 6b785a9..d642a74 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -225,7 +225,7 @@ function testNodeRevisionWithoutLogMessage() { * Tests the revision translations are correctly reverted. */ public function testRevisionTranslationRevert() { - // Create a node and a few of revisions. + // Create a node and a few revisions. $node = $this->drupalCreateNode(['langcode' => 'en']); $this->createRevisions($node, 2);