Closed (fixed)
Project:
Pathauto
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Jun 2021 at 15:41 UTC
Updated:
27 Feb 2026 at 09:39 UTC
Jump to comment: Most recent
Comments
Comment #2
james.williamsWorks great from my point of view - thank you!
Comment #3
berdirmakes sense but all contributions must be done as merge requests now to ensure that current tests still pass.
Comment #5
james.williamsMR !84 is ready then :)
Comment #6
matthiasm11 commented+1 for this patch / merge request.
Comment #8
mably commentedComment #9
mably commentedChange record: hook_pathauto_pattern_alter() context data
What changed
In
PathautoGenerator::createEntityAlias(), the token replacement call now uses$context['data']instead of the original$datavariable. This means modulesimplementing
hook_pathauto_pattern_alter()can now modify$context['data']to alter the token data used for alias generation.Before
The
$contextarray (including'data') was passed to the alter hook, buttoken->replace()used the original$datavariable. Any modification to$context['data']in the hook was silently ignored.After
token->replace()now reads from$context['data'], so alter hook modifications take effect. For example, a module can inject additional token data to be used with an altered pattern:Backward compatibility
hook_pathauto_pattern_alter(), or if the hook doesn't modify$context['data']— behavior is identical.$context['data']for its own purposes (e.g. logging) without intending it to affect token replacement — those changes will now produce different aliases.Comment #11
mably commented