Follow-up to #3575163. Move DomainSourcePathProcessor's outbound path processor priority from 90 to 310, so it runs before core's AliasPathProcessor (300) instead of after.
This allows domain_path (at priority 305) to alias the internal path for the target domain and set $options['alias'] = TRUE, preventing core from overwriting with the active-domain alias. The previous approach (priority 90, after core aliasing) required a wasteful reverse-resolve step and a hook_domain_source_alter implementation.
At priority 310, DomainSourcePathProcessor receives internal paths (/node/1) instead of aliases. This works because DomainSourceRouteMatcher does its own inbound processing internally, and allowedPath() also handles internal paths.
New priority chain:
| Priority | Processor | Module | What it does |
|---|---|---|---|
| 310 | DomainSourcePathProcessor |
domain_source | Determines source domain, sets options['domain'] |
| 305 | DomainPathOutboundProcessor |
domain_path | Aliases for target domain, sets options['alias'] = TRUE |
| 300 | Core AliasPathProcessor |
path_alias | Skipped when options['alias'] is TRUE |
| 80 | DomainPathProcessor |
domain | Rewrites base_url to target domain |
Issue fork domain-3575227
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mably commentedBC breaking changes
Medium
1.
hook_domain_source_alter()no longer receives a rewritten$pathPreviously,
domain_pathimplementedhook_domain_source_alter()to swap the alias in$pathfor the target domain. Any other module implementing this hook that relied on$pathalready containing a domain-specific alias will no longer see that — the hook still fires (inDomainSourcePathProcessor), but$pathis now the internal path (e.g./node/1) sinceDomainSourcePathProcessorruns before core aliasing.2.
DomainSourcePathProcessornow receives internal paths, not aliasesAt priority 310 (before core's
AliasPathProcessorat 300), the$pathargument passed toDomainSourcePathProcessor::processOutbound()is the internal system path (/node/1), not an alias (/my-page). Any code that:DomainSourcePathProcessorand inspects$pathexpecting an aliasallowedPath()with alias patterns indomain_source.settings.excluded_paths...will need to use internal paths instead.
allowedPath()itself works fine with internal paths, but excluded path patterns must now match internal paths (e.g./node/*instead of/my-alias).Low
3.
domain_path'shook_domain_source_alter()implementation removedModules that depended on
domain_path_domain_source_alter()being invoked (e.g. to observe or further modify the path after domain_path's alias swap) will no longer see that hook fire. The aliasing is now handled entirely byDomainPathOutboundProcessorat priority 305.4.
DomainPathOutboundProcessorpriority changed from 85 to 305Any module that registered an outbound path processor with a priority between 86–304 expecting to run between
DomainSourcePathProcessor(was 90) and core aliasing (300) may now run in a different relative order. Specifically, processors that expected to see$options['domain']already set and the path already aliased will now see the internal path instead.5.
$options['alias'] = TRUEside effectWhen
DomainPathOutboundProcessorfinds a domain-specific alias, it sets$options['alias'] = TRUE. Any processor running after priority 305 that checks this flag will see it set for cross-domain links (it wasn't set before).Comment #4
mably commented@idebr do you think we should merge this?
Comment #5
idebr commentedYep, this should unblock #3575163: Apply domain path alias processing on outbound URLs with a domain option
Comment #7
mably commentedComment #9
mably commented@idebr could you have a look at the fix of the regression introduced by this issue please?
#3575489: DomainSourcePathProcessor uses wrong translation when $options['language'] is not set (priority 310)