| Project: | Category |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Issue Summary
I noticed that category_pathauto.module you implement maky of the pathauto hooks. As of Pathauto 5.x-2.x the purpose of some of the hooks has changed and you should move to using the token module's functions. I imagine that in the next couple of weeks that version will become stable enough that it will be the default release at which point you will need to implement the token hooks instead of (or in addition to) the pathauto hooks in order for the integration to work.
Instead of that function, you should now implement two new functions:
hook_token_list
hook_token_values
For more information see the API.txt in the token module http://drupal.org/project/token
During a migration period when some users may still be using Pathauto5.x-1.x it is probably best to leave the hook_pathauto_node in your module so that your module is compatible with both versions.
If you would like more assistance, you can ask questions in the tokens group: http://groups.drupal.org/tokens so that they are around for other folks making the crossover.
For an example you can look at the change in pathauto_node_event.inc
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/pathauto/cont...
Comments
#1
What's the status on this?
I'm using the latest version of Category and [categorypath] and [categorypathfirst] tokens don't work.
Thanks,
Andrey.
#2
Here's an (untested) patch.
I'd appreciate if you'd test this and make sure I didn't screw anything up during the conversion.
Thanks,
-Brandon Bergren
(Interim) Category maintainer
#3
Hey bdragon - the example I pointed to actually doesn't work :( sorry.
You want to remove the references to pathauto since it's just token module (which pathauto relies on) that needs to be integrated with.
So, category_pathauto_token_values(...) should be category_token_values(...)
And the comments about the token_values and token_list functions could be modified to drop the "pathauto" from the description.
Other than that, your implementation looks reasonable, though I don't know enough of the category code to say whether it's right or not.
So, it needs some slight work but is 99% of the way there as far as I can tell.
#4
Can someone re-roll with greggles suggestions ?
Maybe you can sort it greggles ? If not, nice one on the comments :)
Ta
#5
The changes I suggested are trivial - it just needs bdragon (or another committer) to find some round tuits ;)
#6
Yep, should get another shipment of tuits in soon ;)
#7
Waiting at the docks for that shipment of tuits ;)
#8
Any ETA on the ship? ;-)
#9
Meh. Could someone just do the fix and test it for me? I'm really having time issues...
#10
Hello there,
I just applied the patch, and replaced "category_pathauto_token_list" with "category_token_list" - the category aliases still don't show up on the pathauto settings page.
I'd like to get this going, as it sounds like a very small fix that needs to be done.
Any ideas?
Andrey.
#11
mr.andrey - when something like that happens generally the way that the code is addressing the data is wrong.
I generally add a "drupal_set_message(print_r($object, true));" to the code right about the part that isn't working and see what comes out. Then it becomes clear what needs to be changed in the code.
#12
function category_token_list($type = 'all') {
if ($type == 'all' || $type == 'node') {
drupal_set_message('yes');
$tokens['node']['container'] = t('For category nodes, the container of the categ$
$tokens['node']['categorypath'] = t('For category or container nodes, as [title]$
$tokens['node']['containerfirst'] = t("The container that the page's first assig$
$tokens['node']['categoryfirst'] = t("The page's first assigned category.");
$tokens['node']['categorypathfirst'] = t('As [categoryfirst], but including its $
}
}
It seems to get this far, thought the list of tokens is not generated, and entering [categorypath] anyway doesn't do anything.
I'm not entirely sure what I'm looking for...
Andrey.
#13
Got it.
The category_token_list did not return the $tokens array.
Functions renamed according to greggles input, however these functions are still in the category_pathauto.module and not within category.module itself.
Patch attached.
Cheers.
#14
Can someone explain to me how to implement this patch as I believe I am having this same problem? Thanks!
#15
Is this ready to go?
@Bdragon - if you don't want this in the core category module please let us know so that someone can create a helper module. Thanks.
#16
If you are unsure how to apply patches - http://drupal.org/patch/apply
#17
Oops!
I guess I missed the issue email.
Applied to HEAD, DRUPAL-5, DRUPAL-4-7.
#18
#13 that is.
#19
Does that patch make category work with pathauto 2? Is it working is it tested? Does it need testing?
#20
Automatically closed -- issue fixed for two weeks with no activity.
#21
This patch works great... any thoughts on incorporating it into category.modules head?
#22
categorypathfirst generat merged url for example
instead of news/commercial/my-first-news generate newscommercialmyfirstnews
#23
any idea for this issue?
i am realy confused any thing for categorypath of category and container works well but when categorypathfirst setted for other node types ,this put merged url for urlaliase
for example
if container is: news
category: commercial
node title: my first news
url alias maked as: newscommercialmy-first-news
instead of : news/commercial/my-first-news
how can i solve this problem
i think this is caused by url filtering
thanks all
#24
Issues are different than normal comments - when you change the "issue title" in the comment it changes the whole issue title.
I believe the problem is with categorypathfirst which should be renamed to categoryfirstpath - pathauto has special handling for tokens that end in "path" or "alias" or "path-raw" or "alias-raw" that will leave the / inside of the token.
#25
ok sorry for changing issues title,
thanks man
i will test it and as soon as possible reply how it works..
i am realy confused why a module like category with this great idea have these bugs and dont put these patchs in core of module