bookpathalias token broken
mikeque - May 6, 2008 - 14:19
| Project: | Pathauto |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | greggles |
| Status: | closed |
Description
I am trying to use pathauto to generate custom paths based on the top parent of a book. I have tried several different options including [menupath-raw], [book-raw] , and many others as the pattern for Book page paths. When I create a sub-page of a book, they all fail silently, except for [nid] and [title-raw].
Have I made an error in the pathauto admin or is this a bug?

#1
Duplicate of token issue http://drupal.org/node/223458, fixed in the 6.x-1.x-dev release.
#2
Actually, bookpathalias is the responsibility of Pathauto so we need to fix that.
#3
And here's a patch which does this.
I wish there were an API for getting the menu data but all of the menu API functions I could find expected me to have the menu router or path and then it would return the other data.
I also re-ordered the code so that the book stuff is separated from the term/cat stuff, but if we do that then maybe we need to do just that re-organization for 5.x as well.
#4
Default node pattern: [title-raw]
Book page pattern: [bookpathalias]/[title-raw]
Making a "book page" on the top level triggers a couple of notices:
The last one goes away with the patch applied.
Making a node "Super" as the top-level book entry creates a node with the alias "super". Pre-patch, making a node "Sub" as a child node of "Super" creates alias "sub". Post-patch, making child node "Sub 2" creates the alias "super/sub-2".
Marking RTBC.
#5
Eh. Oh, one more thing though. The SQL query is surrounding by superfluous double quotes. The attached patch is the one I tested - it is basically identical to the one in #13, it's just got a pair of double quotes changed to a pair of single quotes. :)
#6
Or... not attached. Let's try again.
#7
That bug is really annoying.
#8
#9
#10
Bloody hell. I give up.
I changed
+ $parent_node = db_result(db_query("SELECT link_path FROM {menu_links} WHERE mlid = %d", $object->book["p$i"]));to
+ $parent_node = db_result(db_query('SELECT link_path FROM {menu_links} WHERE mlid = %d', $object->book["p$i"]));#11
Fixed. Now to make the code structures a little more consistent...
#12
I didn't commit that last patch...if this lack of similarity becomes a problem in the future we can worry about it then.
#13
Well, now I accidentally committed the patch from #11 as part of http://drupal.org/cvs?commit=122748
So, yay synchronization!
#14
Automatically closed -- issue fixed for two weeks with no activity.