Skip to content

Commit

Permalink
Updated term logic to match node logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
kepol committed Nov 3, 2023
1 parent abd7963 commit 4c053fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Seed.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,19 +255,19 @@ public static function seedTaxonomyTerm($entity, $langcode = NULL) {
foreach ($metaManager->getDefinitions() as $pid => $def) {
$plugin = $metaManager->createInstance($pid);
if ($plugin->applies($entity)) {
$meta = array_merge($meta, $plugin->build($entity));
$meta = array_merge($meta, $plugin->build($entity, $langcode));
}
}

\Drupal::service('event_dispatcher')->dispatch(new QuantEvent($markup, $url, $meta, NULL, $entity, $langcode), QuantEvent::OUTPUT);

// Create canonical redirects from taxonomy/term/172 to the aliased route.
if ("/taxonomy/term/{$tid}" != $url && $entity->isPublished()) {
// Use the default language alias in the event of multi-lang setup.
$defaultLanguage = \Drupal::languageManager()->getDefaultLanguage();
$defaultUrl = Url::fromRoute('entity.taxonomy_term.canonical', ['taxonomy_term' => $tid], ['language' => $defaultLanguage])->toString();
\Drupal::service('event_dispatcher')->dispatch(new QuantRedirectEvent("/taxonomy/term/{$tid}", $defaultUrl, 301), QuantRedirectEvent::UPDATE);
}

\Drupal::service('event_dispatcher')->dispatch(new QuantEvent($markup, $url, $meta, NULL, $entity, $langcode), QuantEvent::OUTPUT);
}

/**
Expand Down

0 comments on commit 4c053fa

Please sign in to comment.