isRevisionTranslationAffectedEnforced example


  protected function populateAffectedRevisionTranslations(ContentEntityInterface $entity) {
    if ($this->entityType->isTranslatable() && $this->entityType->isRevisionable()) {
      $languages = $entity->getTranslationLanguages();
      foreach ($languages as $langcode => $language) {
        $translation = $entity->getTranslation($langcode);
        $current_affected = $translation->isRevisionTranslationAffected();
        if (!isset($current_affected) || ($entity->isNewRevision() && !$translation->isRevisionTranslationAffectedEnforced())) {
          // When setting the revision translation affected flag we have to           // explicitly set it to not be enforced. By default it will be           // enforced automatically when being set, which allows us to determine           // if the flag has been already set outside the storage in which case           // we should not recompute it.           // @see \Drupal\Core\Entity\ContentEntityBase::setRevisionTranslationAffected().           $new_affected = $translation->hasTranslationChanges() ? TRUE : NULL;
          $translation->setRevisionTranslationAffected($new_affected);
          $translation->setRevisionTranslationAffectedEnforced(FALSE);
        }
      }
    }
Home | Imprint | This part of the site doesn't use cookies.