hasSynchronizedPropertyChanges example

if (!$this->contentTranslationManager->isEnabled($entity_type_id$entity->bundle())) {
      return;
    }
    $synchronized_properties = $this->getSynchronizedPropertiesByField($entity->getFieldDefinitions());
    if (!$synchronized_properties) {
      return;
    }

    /** @var \Drupal\Core\Entity\ContentEntityInterface $original */
    $original = $this->getOriginalEntity($entity);
    $original_translation = $this->getOriginalTranslation($entity$original);
    if ($this->hasSynchronizedPropertyChanges($entity$original_translation$synchronized_properties)) {
      if ($entity->isDefaultTranslationAffectedOnly()) {
        foreach ($entity->getTranslationLanguages(FALSE) as $langcode => $language) {
          if ($entity->getTranslation($langcode)->hasTranslationChanges()) {
            $this->context->addViolation($constraint->defaultTranslationMessage);
            break;
          }
        }
      }
      else {
        $this->context->addViolation($constraint->defaultRevisionMessage);
      }
    }
Home | Imprint | This part of the site doesn't use cookies.