Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a case where occasionally the alias fails to be generated (node title ends up being empty in the token replacement). I would like to act on that event and add some special logic to create my own automatic alias. Attached is a patch that proposes a solution by adding another alter hook as a second chance.
Is there an easier way to do this? If not, would you consider adding this to the module?
Thx!
Comment | File | Size | Author |
---|---|---|---|
#12 | 1565850-hook-pathauto-alias-alter-D6.patch | 2.74 KB | Dave Reid |
#10 | 1565850-hook-pathauto-alias-alter.patch | 3.07 KB | Dave Reid |
#5 | 1565850-hook-pathauto-alias-alter.patch | 1.23 KB | Dave Reid |
#2 | pathauto_retry-1565850-2.patch | 1.24 KB | Kevin Hankens |
pathauto_retry_alter.patch | 1011 bytes | Kevin Hankens | |
Comments
Comment #1
Dave ReidI'm not sure about the feasibility of this. What if instead we allowed you to alter $pattern before token replacement is performed ala hook_pathauto_pattern_alter(&$pattern)?
Comment #2
Kevin Hankens CreditAttribution: Kevin Hankens commentedThx for the quick reply! That would be a great fix for me personally. New patch attached for general perusal.
Comment #3
Kevin Hankens CreditAttribution: Kevin Hankens commentedComment #5
Dave ReidI was thinking something more like this.
Comment #6
Kevin Hankens CreditAttribution: Kevin Hankens commentedThat could work. If I call token_replace() from within that hook I can test to see if the alias will be empty when it is officially generated. It's a bit of an estimation, but that should be ok.
Plus, I really really like the idea of having more control over the patterns themselves!
Comment #7
Kevin Hankens CreditAttribution: Kevin Hankens commentedComment #8
Kevin Hankens CreditAttribution: Kevin Hankens commentedJust checking back on this one. What is the next step to get this patch in? Do you need more eyeballs on it first?
Thx!
Comment #9
Dave ReidRe-titling and preparing for commit.
Comment #10
Dave ReidRevised final patch.
Comment #11
Dave ReidPushed #10 to 7.x-1.x. Marking as needs to be backported to 6.x-2.x. http://drupalcode.org/project/pathauto.git/commit/fb961c0
Comment #12
Dave ReidPatch against 6.x-2.x.
Comment #13
Dave ReidCommitted #12 to 6.x-2.x. http://drupalcode.org/project/pathauto.git/commit/9678143
Comment #14
Dave ReidComment #16
rudiedirkx CreditAttribution: rudiedirkx commentedPlease create a new release. It's been 3 years. It's about time these goodies are actually usable.
Comment #17
rudiedirkx CreditAttribution: rudiedirkx commented7.x.1.x commit: http://cgit.drupalcode.org/pathauto/commit/?id=fb961c08d49d3974d33014f52...