Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Entity / Plugin / Validation / Constraint / EntityUntranslatableFieldsConstraintValidator.php
index 5b1ad1f5c99591913d8e586ea2fae066d1d193e6..730e5390cb5259dd1b14f22e93a19e797f6e67e0 100644 (file)
@@ -6,7 +6,6 @@ use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
 use Drupal\Core\Entity\ContentEntityInterface;
 use Drupal\Core\Entity\EntityChangesDetectionTrait;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Field\ChangedFieldItemList;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\Validator\Constraint;
 use Symfony\Component\Validator\ConstraintValidator;
@@ -111,19 +110,9 @@ class EntityUntranslatableFieldsConstraintValidator extends ConstraintValidator
         continue;
       }
 
-      // When saving entities in the user interface, the changed timestamp is
-      // automatically incremented by ContentEntityForm::submitForm() even if
-      // nothing was actually changed. Thus, the changed time needs to be
-      // ignored when determining whether there are any actual changes in the
-      // entity.
-      $field = $entity->get($field_name);
-      if ($field instanceof ChangedFieldItemList) {
-        continue;
-      }
-
-      $items = $field->filterEmptyItems();
+      $items = $entity->get($field_name)->filterEmptyItems();
       $original_items = $original->get($field_name)->filterEmptyItems();
-      if (!$items->equals($original_items)) {
+      if ($items->hasAffectingChanges($original_items, $entity->getUntranslated()->language()->getId())) {
         return TRUE;
       }
     }