Token bug

Another step on the return to active web development... Setting up my books on this site, with the pathauto module enabled, I found that the book title was not being substituted in the URL as it should.

For a little context, I was the original author of the pathauto module a few years back - this module automatically generates user-friendly aliases for Drupal content based on patterns you set up. For example, this post would have the address http://mikeryan.name/node/8 without pathauto, but because I've set it up with a pattern of blog/[author-name-raw]/[title-raw], it has the address http://mikeryan.name/blog/mikeryan/token-bug instead.

Anyway, I left active web development for a while, and maintenance of the pathauto module passed to Greg Knaddison, who split out the token-handling code into the token module, which provides token substitution services to several other modules. But, don't blame Greg - I got bit by my own design decision. To support using book titles and paths in book page aliases, I made use of an internal book module function, book_location(). That function has gone away with Drupal 6, breaking the token module.

So, I've reported the issue, now I'll give fixing it a try...

 

Tags

Comments

<p>As referenced elsewhere, my first patch generates an (apparently harmless) error message when saving non-book nodes. The fix is to replace <b>if ($node-&gt;book) {</b> with <b>if ($path = _book_location($node)) {</b> (and remove the now-redundant assignment to <b>$path</b>). Thursday night I'll come back to this - do more testing and make sure I'm patching against the latest 6.0 revision (having some trouble with Eclipse identifying what revision I needed).</p><p>&nbsp;</p>