- Status changed to Closed: duplicate
9 months ago 1:56pm 4 April 2024 - 🇫🇷France xavier.masson Haute-Normandie
Duplicate of Paths not set as expected when setActiveDomain() used → who's created the issue first.
As processOutbound calls getActiveDomain, outbound URLs are always relative to the request URI.
For my use case, I need the ability to programmatically generate links for a given domain regardless of the originating request URL.
I've updated processOutbound to check if a domain entity has been passed in via options, and if not default to getActiveDomain.
The merge request below allows you to pass the CountryPathDomain entity in a new 'domain' option, for example:
/** @var \Drupal\language\Entity\ConfigurableLanguage $language */
$language = \Drupal::entityTypeManager()->getStorage('configurable_language')->load('de');
/** @var \Drupal\country_path\Entity\CountryPathDomain $domain */
$domain = \Drupal::entityTypeManager()->getStorage('domain')->load('fr');
$url = URL::fromRoute('entity.node.canonical', ['node' => 1], ['domain' => $domain, 'language' => $language]);
$url_string = $url->toString();
Closed: duplicate
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Duplicate of Paths not set as expected when setActiveDomain() used → who's created the issue first.