diff --git a/src/Plugin/QueueItem/NodeItem.php b/src/Plugin/QueueItem/NodeItem.php index 3aa580ff..2e9789bb 100644 --- a/src/Plugin/QueueItem/NodeItem.php +++ b/src/Plugin/QueueItem/NodeItem.php @@ -60,10 +60,30 @@ public function send() { $entity = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($this->vid); } + if (!$entity) { + \Drupal::logger('quant_seed')->error( + 'Failed to load entity for node ID: @id, revision ID: @vid', + [ + '@id' => $this->id, + '@vid' => $this->vid, + ] + ); + return; + } + foreach ($entity->getTranslationLanguages() as $langcode => $language) { if (!empty($this->filter) && !in_array($langcode, $this->filter)) { continue; } + + \Drupal::logger('quant_seed')->notice( + 'Processing language @langcode for node @id', + [ + '@langcode' => $langcode, + '@id' => $this->id, + ] + ); + Seed::seedNode($entity, $langcode); } } diff --git a/src/Seed.php b/src/Seed.php index 9f71efb7..d8e72a7f 100644 --- a/src/Seed.php +++ b/src/Seed.php @@ -212,6 +212,10 @@ public static function unpublishRedirect($redirect) { * Seeds taxonomy term. */ public static function seedTaxonomyTerm($entity, $langcode = NULL) { + + // Use the translation to ensure correct metadata such as published state. + $entity = $entity->getTranslation($langcode); + $tid = $entity->get('tid')->value; $url = Utility::getCanonicalUrl('taxonomy_term', $tid, $langcode); @@ -264,6 +268,9 @@ public static function seedTaxonomyTerm($entity, $langcode = NULL) { */ public static function seedNode(EntityInterface $entity, $langcode = NULL) { + // Use the translation to ensure correct metadata such as published state. + $entity = $entity->getTranslation($langcode); + $nid = $entity->get('nid')->value; $rid = $entity->get('vid')->value;