public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { if (array_key_exists('purl_context', $options) && $options['purl_context'] == false) { if (count($this->matchedModifiers->getMatched()) && $bubbleable_metadata) { $cacheContexts = $bubbleable_metadata->getCacheContexts(); $cacheContexts[] = 'purl'; $bubbleable_metadata->setCacheContexts($cacheContexts); } return $this->contextHelper->processOutbound($this->matchedModifiers->createContexts(Context::EXIT_CONTEXT), $path, $options, $request, $bubbleable_metadata); } return $this->contextHelper->processOutbound($this->matchedModifiers->createContexts(), $path, $options, $request, $bubbleable_metadata); }
/** * @param string|\Symfony\Component\Routing\Route $name * @param array $parameters * @param array $options * @param bool $collect_bubbleable_metadata * @return \Drupal\Core\GeneratedUrl|string */ public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE) { $hostOverride = null; $originalHost = null; $action = array_key_exists('purl_context', $options) && $options['purl_context'] == false ? Context::EXIT_CONTEXT : Context::ENTER_CONTEXT; $this->contextHelper->preGenerate($this->matchedModifiers->createContexts($action), $name, $parameters, $options, $collect_bubbleable_metadata); if (isset($options['host']) && strlen((string) $options['host']) > 0) { $hostOverride = $options['host']; $originalHost = $this->getContext()->getHost(); $this->getContext()->setHost($hostOverride); } $result = $this->urlGenerator->generateFromRoute($name, $parameters, $options, $collect_bubbleable_metadata); // Reset the original host in request context. if ($hostOverride) { $this->getContext()->setHost($originalHost); } return $result; }