Bug fix
Line 232 has a typo:
unset($domains['source']);This unsets the literal key 'source' instead of the variable $source. The intent is to remove the source domain from the access domains list to avoid duplicates (since it's added separately on line 235), but the typo means the source domain ends up in the URL list twice.
Simplification
Follow-up to #3575069. With the new priority chain (DomainSourcePathProcessor at 310, DomainPathOutboundProcessor at 305, core at 300), getContentUrls() can set $options['domain'] directly instead of going through domain_target_id.
The current code:
- Sets
$options['domain_target_id']with the domain ID DomainSourcePathProcessorloads the domain entity again, re-loads the node entity, does route matching, fireshook_domain_source_alter, then finally sets$options['domain']- Branches on
$processedto decide between using the generated URL directly vs. manually calling$domain->buildUrl()
With $options['domain'] set directly:
DomainSourcePathProcessorshort-circuits (it already checksisset($options['domain']))DomainPathOutboundProcessoraliases the path for the target domainDomainPathProcessorrewritesbase_url- All URLs are absolute — no need for the
$processedbranching or$domain->buildUrl()fallback
Issue fork domain-3575261
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 commentedBug fix
DomainAccessManager::getContentUrls()had a typo on line 232:This unsets the literal key
'source'instead of the variable$source, causing the source domain to appear twice in the URL list.Simplification
getContentUrls()now sets$options['domain']directly instead of going through$options['domain_target_id']. This skips the expensiveDomainSourcePathProcessorroundtrip (entity re-loading, route matching, hook invocation) since the domain entity is already loaded in the loop.All URLs are now always absolute — the
$processedbranching and$domain->buildUrl()fallback are no longer needed, sinceDomainPathProcessor(priority 80) rewritesbase_urlwhen$options['domain']is set.Deprecation
$options['domain_target_id']inDomainSourcePathProcessoris now deprecated. Callers should set$options['domain']to aDomainInterfaceentity directly instead. The existingdomain_target_idlogic is preserved for backward compatibility and will be removed indomain:4.0.0.Comment #5
mably commentedComment #7
idebr commentedNice clean-up 👌