Closed (fixed)
Project:
Pathauto
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Mar 2009 at 15:12 UTC
Updated:
18 May 2011 at 12:38 UTC
Imagine you work with two menus: primary-links and seo-links.
Node 1 has a menu-entry in both primary-links and seo-links.
If pathauto generates an url-alias for node 1, which menu-entry is source?
Behavior now: pathauto takes the first entry found in table menu_links matching link_path (is that right?)
I suggest to provide an interface where we can define which menu pathauto should take as a source for [menupath].
Comments
Comment #1
gregglesI think you are right about how it works now. I think this is an overly complex feature that we should not expose in the UI. Instead you could write a site-specific token implementation that provides the menu token you want. I've been meaning to write a tutorial on how to do that for a while, so...I'll leave this open and provide a link when I've done it.
Comment #2
guldi commentedI would like to help.
I'll check if I can do it.
Any tips appreciated. :)
Comment #3
gregglesIn the short run, your best resource is http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/token/API.txt and http://www.archive.org/details/DrupalconDc2009-TokenTheLittleApiThatCould
Comment #4
guldi commentedHum. Did I understand right, you just want a tutorial on how to provide user-defined tokens?
Another suggestion would be to just implement the [menuxy-menupath-raw] tokens in the token module. (For each menu one new token)
Comment #5
gregglesOf course it is possible to provide these tokens in the token module, but we are generally not adding new tokens to it because each new token is a performance issue and UI issue.
Comment #6
guldi commentedOk, so I did it via a helper module to just satisfy my needs.
So after adding this functions, you are able to district your menu-tokens to a specific menu.
Eg: [primary-links-menupath-raw] (what I needed)
Comment #7
guldi commented@greggles: for me it's closed.
Feel free to reopen it in order to keep it as a reminder for you to write your tut.
Thx!
Comment #8
Proct0t commentedthe code above works fine for me at the moment, thanks!
Comment #9
imiksu#6 code example wont fully work in my case. It created tokens as expected, but I'm now having similar problem as #881270: [bookpath], [menupath], [*path] tokens not cleaned: aliases without punctuation removed, lower casing, etc.. Tokens gets not cleaned.
I'm using "Pathauto 6.x-1.5" and "Token 6.x-1.15".
Comment #10
imiksuThis code example works with latest "Pathauto 6.x-1.5" and "Token 6.x-1.15" modules. I used this patch as reference: http://drupal.org/files/issues/881270-token-path-tokens_109.patch
Comment #11
brankoc commentedThanks iMiksu, just what I needed.
In case anyone's wondering, Pathauto 1.3's
was changed into Pathauto 1.5's