Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello!
For a content type I created custom field_test of List|text type, with items like
key1|label1
key2|label2
Then I try to use it in patterns to autogenerate aliases.
I want generated path to be /key1/1 and /key2/2
Pattern looks like [node:field_test]/[node:nid] and i suppose that it will do what i want, but...
Generated aliases are just /label1/1 and /label2/2
Comments
Comment #0.0
q11q11 CreditAttribution: q11q11 commentedminor correction
Comment #1
divbox CreditAttribution: divbox commentedHaving the same problem. I think it relates to this #1220534: Fields in path which is now closed, but that relates to this #691078: Field tokens which is still open, and has been for some time.
I'm trying to work around this using hook_node_submit or hook_node_insert, but I don't have it working yet. I also feel this is kinda hacky, but whatcha gonna do :)
I'll post a response if I get it working.
div
Comment #2
q11q11 CreditAttribution: q11q11 commentedWe use hook_pathauto_alias_alter() with modification of alias itself, then just bulk update.
But it`s just workaround.
Comment #2.0
q11q11 CreditAttribution: q11q11 commentedminor corrections