If you want to do this, then please assign this issue to yourself, and post updates and patches in this thread (not in the main d6 upgrade thread). Volunteer(s) wanted! Thanks.

CommentFileSizeAuthor
#2 category_pathauto.zip1.68 KBmkassets
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

falk_g’s picture

why exactly would pathauto not "just work" and needs another plugin? (Sorry to repeat myself). I think the wrappers should just take care of it and have pathauto not see a difference between a category category and a drupal taxonomy or am I missing something vital? a lot of my hassle with d5 is to get pathauto and token to work properly - it would be nice if this was just handled by the core plugin pretending to be "normal" taxonomy and then pathauto picking it up from there. I also find it a tiny bit confusing to have tons of tokens that basically say the same thing "term or category" or "container or vocab" so I would like to propose a solution that would make a more seamless and stealthy aproach of category6 by closely mimicking the original taxonomy sheme (I mean it basically does that already but in D5 not perfect enough for these modules to just pick it up) and make all these modules think they are communicating with the real deal. Just thinking out loud maybe I am missing something vital - I have been kneedeep in the code but only understand 50% of it so please bear with me.

mkassets’s picture

FileSize
1.68 KB

Attached is the category_pathauto module I have ported to D6.

I have never contributed before and this is my first post here. I simply needed the category_pathauto module for one of the websites I am working on, but once it is done I want to share it with the community. I am not familiar with the procedures here, I do not know how to "assign" the task to me, nor do I have time to start with CVS accounts, style checking scripts, etc. I thought I'll just post the sources here, use them if you want to.

The changes versus D5 are

1. The module is now using the hook_token_list() and hook_token_values() hooks instead of the deprecated hook_pathauto_node()

2. The token [categorypathfirst] has been changed to [categoryfirstpath]. The reason is that the pathauto URL cleaner pathauto_clean_token_values() checks the last characters of the token to determine if it is a valid path/URL. So that any token that includes '/' characters must end with 'path' or 'path-raw', or otherwise the '/' characters will be removed

3. I took the liberty to remove the translation of the token keys (i.e t('[categorypath]') is now ['categorypath']). Translating tokens has never made sense to me - it is like trying to translate reserved keywords of a programming language (hmm... how do I code a PHP loop in Hebrew...). I apologize if this is against the convention, as I said, I developed the module in accordance with my needs.

4. I also took the liberty to leave all the *first* tokens unassigned when dealing with container and category nodes, cause I have never understood why these are needed for categories/containers

5. Another deviation from the original category_pathauto behavior: a node title is never a part of the [categorypathfirst] (or in this version it is [categoryfirstpath]). In the D5 version, node title was added to the [categorypathfirst] and at least for me it caused a confusion. When I want a node title to be part of the URL I add it explicitly, e.g. [categoryfirstpath]/[title-raw]

The attached code is working fine for me, but I have not put it through an extensive test. Use it at your own risk.

My Best,
mkassets

JirkaRybka’s picture

Status: Active » Needs review

I wonder why I didn't ever click on this issue :-/ I kind of want pathauto integration on my site, and there's a 6.x port waiting for review... It should have been set to "needs review" IMO.

So, I'm going to review this as time permits (no promises), along with the issue queue cleanup #585504: Summarize issues related to pathauto integration.

HeNuS_spb’s picture

Sometimes get "Fatal error: Call to undefined function pathauto_cleanstring()".
The error only occurs when the node has a taxonomy term assigned to it and has filefield field.

To fix it function category_pathauto_token_values should be:

function category_pathauto_token_values($type, $object = NULL) {
_pathauto_include(); // the magic
  if ($type == 'node' && isset($object)) {
    $tokens = category_pathauto_get_placeholders($object);
    return $tokens;
  }
}
fizk’s picture

What's going on with this? Is someone looking at it?