Skip to content

Commit

Permalink
Clean up decoupled preview url
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 8, 2024
1 parent 3e2d5d3 commit d5a3db7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/stanford_decoupled/stanford_decoupled.module
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function stanford_decoupled_next_site_insert(EntityInterface $entity) {
'sites' => [$entity->id() => $entity->id()],
],
'revalidator_configuration' => [
'revalidate_page' => false,
'revalidate_page' => FALSE,
'additional_paths' => "/tags/config-pages",
],
])->save();
Expand Down Expand Up @@ -286,6 +286,18 @@ function stanford_decoupled_next_site_preview_alter(array &$preview, array $cont
if ($context['entity']->getEntityTypeid() != 'node') {
$preview = $context['original_build'][0]['content'];
}

if (isset($preview['toolbar']['links']['#links']['live_link']['url'])) {
/** @var \Drupal\Core\Url $url */
$url = $preview['toolbar']['links']['#links']['live_link']['url'];
$options = $url->getOptions();
// No need for all the other parameters.
$options['query'] = [
'slug' => $options['query']['slug'],
'secret' => $options['query']['secret'],
];
$url->setOptions($options);
}
}

/**
Expand Down

0 comments on commit d5a3db7

Please sign in to comment.