Commit 96017600 authored by Peter Neyens's avatar Peter Neyens Committed by Pravin Gaikwad
Browse files

Issue #3314088 by p-neyens, Rajeshreeputra, alexanderj: Error: Call to a...

Issue #3314088 by p-neyens, Rajeshreeputra, alexanderj: Error: Call to a member function language() on null 
parent 6ca2f803
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ class ContentEntityCloneBase implements EntityHandlerInterface, EntityCloneInter
    $needs_save = FALSE;
    $moderation_state = ContentModerationState::loadFromModeratedEntity($cloned_entity);
    $original_translation = $cloned_entity->getUntranslated();
    if ($moderation_state->language()->getId() !== $original_translation->language()->getId()) {
    if ($moderation_state && ($moderation_state->language()->getId() !== $original_translation->language()->getId())) {
      // If we are cloning a node while not being in the original translation
      // language, Drupal core will set the default language of the moderation
      // state to that language whereas the node is simply duplicated and will
@@ -297,7 +297,7 @@ class ContentEntityCloneBase implements EntityHandlerInterface, EntityCloneInter

    foreach ($languages as $language) {
      $translation = $cloned_entity->getTranslation($language->getId());
      if (!$moderation_state->hasTranslation($translation->language()->getId())) {
      if ($moderation_state && !$moderation_state->hasTranslation($translation->language()->getId())) {
        // We make a 1 to 1 copy of the moderation state entity from the
        // original created already by the content_moderation module. This is ok
        // because even if translations can be in different moderation states,