diff --git a/src/ContextProvider/CurrentPathContext.php b/src/ContextProvider/CurrentPathContext.php index 373637ba..c752133e 100644 --- a/src/ContextProvider/CurrentPathContext.php +++ b/src/ContextProvider/CurrentPathContext.php @@ -37,15 +37,18 @@ class CurrentPathContext implements ContextProviderInterface { * {@inheritdoc} */ public function getRuntimeContexts(array $unqualified_context_ids) { + $url_data = Url::fromRoute('', [], ['absolute' => TRUE])->toString(TRUE); + $values = [ 'path' => $this->currentPathStack->getPath(), - 'url' => Url::fromRoute('', [], ['absolute' => TRUE])->toString(), + 'url' => $url_data->getGeneratedUrl(), ]; $context_definition = new ContextDefinition('current_path', $this->t('Current path')); $context = new Context($context_definition, $values); $cacheability = new CacheableMetadata(); $cacheability->setCacheContexts(['url.path']); + $cacheability->merge($url_data); $context->addCacheableDependency($cacheability); $result = [ diff --git a/src/ContextProvider/SiteContext.php b/src/ContextProvider/SiteContext.php index fca7c002..890b14b0 100644 --- a/src/ContextProvider/SiteContext.php +++ b/src/ContextProvider/SiteContext.php @@ -44,9 +44,12 @@ class SiteContext implements ContextProviderInterface { * {@inheritdoc} */ public function getRuntimeContexts(array $unqualified_context_ids) { + $front_url_data = Url::fromRoute('', [], ['absolute' => TRUE])->toString(TRUE); + $login_url_data = Url::fromRoute('user.page', [], ['absolute' => TRUE])->toString(TRUE); + $site = [ - 'url' => Url::fromRoute('', [], ['absolute' => TRUE])->toString(), - 'login-url' => Url::fromRoute('user.page', [], ['absolute' => TRUE])->toString(), + 'url' => $front_url_data->getGeneratedUrl(), + 'login-url' => $login_url_data->getGeneratedUrl(), 'name' => $this->systemSiteConfig->get('name'), 'slogan' => $this->systemSiteConfig->get('slogan'), 'mail' => $this->systemSiteConfig->get('mail'), @@ -56,6 +59,8 @@ class SiteContext implements ContextProviderInterface { $context = new Context($context_definition, $site); $cacheability = new CacheableMetadata(); $cacheability->setCacheContexts(['site']); + $cacheability->merge($front_url_data); + $cacheability->merge($login_url_data); $context->addCacheableDependency($cacheability); $result = [ diff --git a/src/Logger/RulesDebugLoggerChannel.php b/src/Logger/RulesDebugLoggerChannel.php index 58e84af2..4041a092 100644 --- a/src/Logger/RulesDebugLoggerChannel.php +++ b/src/Logger/RulesDebugLoggerChannel.php @@ -96,7 +96,7 @@ class RulesDebugLoggerChannel extends LoggerChannel { Url::fromRoute('entity.rules_reaction_rule.edit_form.expression.edit', [ 'rules_reaction_rule' => $element->getRoot()->getPluginId(), 'uuid' => $element->getUuid(), - ])->toString() : + ])->toString(TRUE)->getGeneratedUrl() : NULL; }