Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We have a bunch of term tokens in D6 token for the taxonomy term of a node that has the lowest weight vocabulary and lowest term weight. We should just make [node:term] a chainable token.
Comment | File | Size | Author |
---|---|---|---|
#113 | tagsno.png | 41.26 KB | artatac |
#52 | token-7.x-1.x-dev.tar_.gz | 31.72 KB | Scott J |
#18 | 741914-token-node-term-D7.patch | 5.52 KB | Dave Reid |
Comments
Comment #1
Dave ReidAny ideas on the name of this token? Ideas are:
[node:term]
[node:lowest-term] (lowest weight = top)
[node:top-term]
Comment #2
DamienMcKennaIn the interest of KISS and convention over configuration, I think [node:term] would be a handy shortcut for the first term.
Comment #3
gregglesI like "top" or "lightest-term" since weights are described as "heavy" and "light" (at least I describe them like that).
Comment #4
DamienMcKennaIf the intention is to make it chainable, maybe [node:term-next] or [node:next-term] so that it is more logically chained out: [node:term-next]/[node:term-next]/[node:term-next]/[node:title]
Comment #5
Dave ReidWhat I meant by making it chainable is that we can use things like [node:term:name] or [node:term:vocabulary:name].
Comment #6
DamienMcKennaAh, righteeo. So what would you get just doing [node:term], the $term->name value?
Comment #7
Dave ReidYep that defaults to the term name.
Comment #8
Dave ReidCome vote on http://twtpoll.com/8y4lke ! :)
Comment #9
Dave ReidI don't think we should actually proceed with this. Marking as postponed for now.
Comment #10
xjmTracking. What was the reason not to proceed?
Comment #11
Dave ReidBecause D7 has no concept of taxonomies for nodes. They're fields and each vocabulary is a separate field. There is no concept of a top 'term' for a node.
Comment #12
xjmI suppose it's sort of a duplicate of #691078: Field tokens. Assuming the field token takes the first entry in a field, that would sort of be the equivalent of the lightest term, and more configurable to boot. It wouldn't work across multiple vocabularies, but that's a feature that's more of a hindrance in D5 and D6, I think.
Comment #13
beckyjohnson CreditAttribution: beckyjohnson commentedAre there really tokens for lower terms provided by the token module? I need this feature and I'm not sure what to do. I need to be able to show a token of a lower taxonomy term in my breadcrumbs.
Becky
Edit: Sorry I misunderstood. Top terms have low weights and vice versa. What I'm trying to research is how to get terms from other vocabularies into tokens and I misread what was discussed above.
Comment #14
artatac CreditAttribution: artatac commentedThe Pattern for all Article paths is using the following invalid tokens: [node:term].
Doesn't currently work in d7beta
Further background
Pattern for all Story paths:
[termpath-raw]/[title-raw]
In D7 beta with your latest dev 'term' is not mentioned in any of the replacement patterns. I tried
Pattern for all Article paths
[term:path]/[node:title]
but got the following error - The Pattern for all Article paths is using the following invalid tokens: [term:path].
Comment #15
Dave ReidYes because the token does not exist. Please read the issue.
Comment #16
artatac CreditAttribution: artatac commentedapols - but in that case could I request that the d6 [termpath-raw] be made available in d7 or is there a workaround/different way of achieving this?
Comment #17
MondayNgt CreditAttribution: MondayNgt commentedI second the addition of a term path, as it was in Drupal 6 pathauto and still don't understand why it's not in D7. I have a client website which uses taxonomy for categories/subcategories for articles and generates the URL accordingly for SEO (for example, /electronics/computers/how-to-reformat-your-machine). I was looking forward to using D7 for the next major version of that site, but this is a showstopper.
Comment #18
Dave ReidPatch to add a [node:term] token for D7 with tests.
Comment #19
artatac CreditAttribution: artatac commentedI downloaded the latest dev of token and this patch then using terminal on the mac ran the patch with only partial sucess see below
please advise
Comment #20
artatac CreditAttribution: artatac commentedBump
Comment #21
artatac CreditAttribution: artatac commentedif this is still an issue contact me direct as I have a solution
Regards
Joe
Comment #22
amfis CreditAttribution: amfis commentedplease, post solution here.
Comment #23
Dig1 CreditAttribution: Dig1 commentedSimilar to #16 and #17, I think D6 taxonomy is great and Pathauto for D6 really helps create Node URLs based on Vocabulary, Term, Sub-Term.
At the moment I can't see how to do that in D7 because the Replacement Patterns for Node Paths don't include Taxonomy terms...
Using Taxonomy for URL Replacement patterns is such a neat feature...it is not yet in D7 or am I missing something?
Thanks
Comment #24
frank31 CreditAttribution: frank31 commentedSubscribing
Comment #25
artatac CreditAttribution: artatac commentedI had to pay a coder to make this work. I was hoping a few of us could share the cost.
Like many I am happy to contribute my time back to the community but when I have to pay hard cash it is nice to get some help
Comment #26
Dave ReidThe patch is ready to test, not sure why you'd need to pay someone?
Comment #27
chronosinteractive CreditAttribution: chronosinteractive commentedHow long until there is a version with this patch included?
Comment #28
artatac CreditAttribution: artatac commentedWhen I last tested the patch it failed and I got no response about the error. See above
Comment #29
chronosinteractive CreditAttribution: chronosinteractive commentedWhat drupal version, and what token version did you test it on?
Comment #30
artatac CreditAttribution: artatac commentedIt is so long ago that it would be quicker to ask you what versions you are finding success with. I will happily redraft and use the latest d7 dev version of each of the modules needed
Comment #31
Dig1 CreditAttribution: Dig1 commentedSUCCESS :). Well guys, while attending the London D7 Launch party I remembered what a great community Drupal is...and today I woke up and 'smelt the coffee'...so first thing I did was research how to apply a patch...I studied Addison Berry's video and read the Drupal Manual.
Then I applied the patch that David provided in #18 and it installed first time using the Token Module directory for root:
patching file token.tokens.inc
Hunk #1 succeeded at 74 (offset 10 lines).
Hunk #2 succeeded at 294 (offset 55 lines).
Hunk #3 succeeded at 312 with fuzz 2 (offset 58 lines).
Hunk #4 succeeded at 875 (offset 131 lines).
patching file token.test
Hunk #1 succeeded at 215 (offset 65 lines).
Hunk #2 succeeded at 240 (offset 68 lines).
Hunk #3 succeeded at 262 (offset 71 lines).
Hunk #4 succeeded at 415 (offset 82 lines).
Then I got really excited when I saw that David had provided the facility for:
'First taxonomy term [node:term] The lowest-weighted taxonomy term associated with the node from the lowest-weighted vocabulary.'
My setup is:
Drupal 7.0, LAMP.
Pathauto 7.x-1.x-dev (2011-Jan-07)
Token 7.x-1.x-dev (2011-Jan-10)
And currently I am happily using:
Pattern for all Reference paths = [node:term:parent]/[node:term:name]/[node:title]
This is brilliant and Dave needs to be praised for his excellent work for the community :)
Thank you Dave
Digby
Comment #32
artatac CreditAttribution: artatac commentedI can confirm that this is working well under Xampp on a windows 7 local host. I am impressed with the range of options but am struggling to find one that does the same as termpath.
I am using [node:term:parent]/[node:term]/[node:title]
which achieves the same as long as the term is only 2 tier eg
vegetables
-potatoes
but would not work if it was
vegetables
-potatoes
--king Edwards
Perhaps I am not looking well enough - but well done for this important contribution
Comment #33
MrSasquatch CreditAttribution: MrSasquatch commentedI cannot get this to work. I replaced my token and pathauto modules with the same versions you're using...
Pathauto 7.x-1.x-dev (2011-Jan-07)
Token 7.x-1.x-dev (2011-Jan-10)
...and then I...
• Deleted all my existing aliases
• Made sure the taxonomy vocabulary I want to use to generate my URLs is the lowest weighted and populated with terms
• Made sure that taxonomy vocabulary is attached to my basic page content type as a required field
Now, when I go into the Pathauto "Patterns" configuration, I see a whole bunch of new built-in replacement patterns that I can use, but I still don't see the ones you're using, like [node:term:parent] and [node:term:name].
Basically I have a "departments" vocabulary attached to my basic page content type as a required field, and I want to structure my URLs like this...
/[DEPARTMENT VALUE]/[node:title]
It's the [DEPARTMENT VALUE] that I don't know how to add to the URL as a replacement pattern. For example, if a particular basic page has the "department" taxonomy vocabulary set to "shirts" and if the name of the page is "Blue Shirt" then I want the page to have a URL like...
/shirts/blue-shirt
What am I missing? Please help. And thank you so much in advance for any help that anyone can provide.
Thanks,
TheSasquatch
Comment #34
Dave ReidAfter you apply the patch, you have to ensure you clear your caches (usually just by running the update.php script even if there were no database updates to run).
Comment #35
MrSasquatch CreditAttribution: MrSasquatch commentedI didn't apply any patches. I just removed token and pathauto and re-added them using the recommended versions. Is that all I need to do? ...or is there also a "patch" that I also have to apply? Please advise, and thank you for your help!!! - TheSasquatch
Comment #36
Dave ReidAs this issue is still 'needs review' it means the patch has not been committed to the Token module yet, so yes, you'll need to still apply the patch yourself in the meantime.
Comment #37
MrSasquatch CreditAttribution: MrSasquatch commentedI ran update.php, and it did apply some updates pertaining to Pathauto, but I still don't see the taxonomy/term-related replacement patterns showing up in the list, and when I try to use the ones shown in the example, I get an error. Any thoughts? Thanks for your help!!! - TheSasquatch
Comment #38
Dave Reid"As this issue is still 'needs review' it means the patch has not been committed to the Token module yet, so yes, you'll need to still apply the patch yourself in the meantime."
Comment #39
MrSasquatch CreditAttribution: MrSasquatch commentedAh, I see. Thanks! Any idea how long it will be before the patch has been committed to the Token module?
Comment #40
willhowlett CreditAttribution: willhowlett commentedIf you can't wait you'll be able to patch the module manually yourself, instructions here: http://drupal.org/node/534548
The patch -> http://drupal.org/files/issues/741914-token-node-term-D7.patch might look a bit intimidating, but it's essentially just a case of adding the lines that begin with +, and removing lines begining with -, to the relevant files at the correct line.
Comment #41
artatac CreditAttribution: artatac commentedcould I ask what the equivalent of the D6 [termpath-raw] in this D7 version please
Thanks
Joe
Comment #42
dominateyourmarket CreditAttribution: dominateyourmarket commentedsubscribe
Comment #43
shelleyp CreditAttribution: shelleyp commentedI have a fairly flat taxonomy, and my paths in D6 consisted of vocabulary name/term name/story title.
Once I updated to the development versions of both token and pathauto, and applied the above patch, I was able to re-create the path using:
[node:term:vocabulary:name]/[node:term:name]/[node:title]
After a very frustrating day yesterday just trying to figure out what the problem was, I can happily say that this worked and I now have the same paths I had under D6.
MANY appreciations (let me repeat...MANY appreciations) to Dave Reid, both for the patch, and for helping me understand what broke between D6 and D7.
Once this is incorporated, the only other addition I would recommend is a file that shows a mapping between the previous patterns and the new one. This should probably be in the pathauto install. Perhaps even something in the config page, itself.
Comment #44
benanderson CreditAttribution: benanderson commentedBig thanks to Dave Reid for his work on this! I applied the patch from #18 above and had an almost identical setup as #31. Everything "just worked".
Many thanks,
Ben
Comment #45
Lars Jansen CreditAttribution: Lars Jansen commentedWith many thanks to Dig1 I now also have the patch David provided in #18 working for me.
My setup is:
Drupal 7.0, LAMP.
Pathauto 7.x-1.x-dev (2011-Jan-07)
Token 7.x-1.x-dev (2011-Jan-10)
node:term ROCKS!
Comment #46
Dave ReidI just realized that the {taxonomy_index} table is only maintained for published nodes only, and not for unpublished nodes, so this requires a different approach that won't cause this token value to go empty after a node is unpublished.
Comment #47
N20 CreditAttribution: N20 commentedworked like a charm! many thanks for that patch
Comment #48
Scott J CreditAttribution: Scott J commentedThank you, thank you. Works for me too.
Drupal is working like a cMs once more.
Comment #49
anavarreSubscribe
Comment #50
nigg1e CreditAttribution: nigg1e commentedI couldn't get this patch to work. I kept getting the message below. This is the first patch I have ever done. Any ideas?
$ patch token.tokens.inc < termpatch.patch
(Stripping trailing CRs from patch.)
patching file token.tokens.inc
Hunk #1 succeeded at 74 (offset 10 lines).
Hunk #2 succeeded at 294 (offset 55 lines).
Hunk #3 succeeded at 312 with fuzz 2 (offset 58 lines).
Hunk #4 succeeded at 876 (offset 132 lines).
(Stripping trailing CRs from patch.)
can't find file to patch at input line 95
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: token.test
|===================================================================
|RCS file: /cvs/drupal-contrib/contributions/modules/token/token.test,v
|retrieving revision 1.27
|diff -u -p -r1.27 token.test
|--- token.test 16 Nov 2010 03:12:10 -0000 1.27
|+++ token.test 16 Nov 2010 04:14:59 -0000
--------------------------
File to patch:
Comment #51
nigg1e CreditAttribution: nigg1e commentedI have just managed to get the patch to work. I think I was using a slightly newer version of token. However, now my site isn't functioning. There are still no options in path auto for me to pick a taxonomy term in the token drop down and also I cant get into my configurations menu! I get this error message every time I try:
Fatal error: require_once() [function.require]: Failed opening required 'C:\wamp\www\drupal7/sites/all/modules/token/token.tokens.inc' (include_path='.;C:\php\pear') in C:\wamp\www\drupal7\includes\module.inc on line 300
Call Stack
# Time Memory Function Location
1 0.0004 674968 {main}( ) ..\index.php:0
2 0.2470 28531944 menu_execute_active_handler( ) ..\index.php:22
3 0.2544 29749144 call_user_func_array ( ) ..\menu.inc:501
4 0.2544 29749384 system_admin_config_page( ) ..\menu.inc:0
5 0.2544 29749432 system_status( ) ..\system.admin.inc:14
6 0.2993 32807136 module_invoke_all( ) ..\system.admin.inc:2237
7 0.3179 33500520 call_user_func_array ( ) ..\module.inc:817
8 0.3179 33500840 token_requirements( ) ..\module.inc:0
9 0.3179 33501128 token_find_duplicate_tokens( ) ..\token.install:13
10 0.3179 33501416 module_implements( ) ..\token.module:779
11 0.3242 33902744 module_load_include( ) ..\module.inc:675
Comment #52
Scott J CreditAttribution: Scott J commentedniggle,
Here's one I prepared earlier...
I just edited this version http://drupal.org/node/734592 by hand, and it's working for me.
Comment #53
effulgentsia CreditAttribution: effulgentsia commentedSubscribe. I didn't follow the full discussion since #9, but what value does this have that isn't captured in #691078: Field tokens? Given that in D7, taxonomy is just a field, what's the point of adding another special case token name on top of the one we'll get from that issue?
Comment #54
Scott J CreditAttribution: Scott J commentedre: #53
The value is in not needing to know in advance what the field names are.
For example, I want to set up the tokens in pathauto and then forget about it. I don't want to have to revisit admin/config/search/path/patterns every time that I add a new vocabulary, content type and/or field. That would rather take the 'auto' out of pathauto.
Comment #55
nigg1e CreditAttribution: nigg1e commentedScott J,
Nice one! This works for me. Still not sure why the version I patched resulted in all the errors when I tried to navigate to the configuration area.
Using Pathauto 7.x-1.0-beta1
Anyway, thanks again.
Comment #56
MrSasquatch CreditAttribution: MrSasquatch commentedSo do I still need the patch to get taxonomy term working in Pathauto, or is this rolled into a dev or alpha or beta by now? Please advise, and thank you so much for assistance.
- TheSasquatch
Comment #57
N20 CreditAttribution: N20 commentedBy the way, you have to create a new node to see the patch working. in my case the url didnt updated properly with the bulkupdate from autopath.
Comment #58
5ulo CreditAttribution: 5ulo commentedI have latest pathauto (7.x-1.x-dev) and token (7.x-1.x-dev) installed and i don't see the token [node:term], so it's still not fixed :(
Comment #59
MrSasquatch CreditAttribution: MrSasquatch commentedSo hard to wait.
Comment #60
N20 CreditAttribution: N20 commentedyou dont see them under "replacement patterns" listed. just use them. if the patch works for you, you dont get any errors using [node:term]
Comment #61
Scott J CreditAttribution: Scott J commentedSulo, and TheSasquatch,
I have posted a fully patched working version at #52 and [node:term] does show up under replacement patterns -> nodes, so please just try it.
Don't forget to visit admin/config/development/performance and "Clear all caches" after you have installed it.
Comment #62
MrSasquatch CreditAttribution: MrSasquatch commentedI trust it works. I don't doubt the patch works. But a patch is not useful to me. We need modules that work as-is because of the constraints of our project. It's a big enough stretch that we're using beta and dev modules. So I'm going to have to wait until a new dev or beta comes out that includes the patch. Any idea when that will be?
Comment #63
effulgentsia CreditAttribution: effulgentsia commentedThe last status change on this issue was in comment #46, where one of the project maintainers responded that the latest patch still needs work, and why. So, unless he changes his mind, it won't be committed to CVS, and therefore, won't be part of a dev snapshot or the next beta release, until someone posts an updated patch that addresses that concern, and the new patch has been adequately reviewed.
Maybe Dave Reid himself will have time to work on that this week. Maybe not. It's usually hard to make predictions of when problems will get solved when it's being worked on in volunteer time. If your project constrains you to not using patches representing in-progress solutions, but only fully worked out solutions that have been incorporated into a release, then I suggest you (or your organization) try to hire someone who can drive this patch to completion. You may want to start by contacting the people who've already contributed on this issue (e.g., Dave Reid and Scott J) to see if they have availability or know someone who does.
Comment #64
willhowlett CreditAttribution: willhowlett commentedTheSasquatch - if this is for clients personally I would stick to Drupal 6 for the time being. That's the approach my company are taking. We're keeping a close eye on the development of the D7 versions of modules we need working, and we won't consider building sites for clients in D7 until all the features we need are in place. In the meantime D6 is still doing the job for us fantastically.
Comment #65
elachlan CreditAttribution: elachlan commentedSubscribing.
#46 - Is there a way to add unpublished nodes to the index? What is the main reason they were removed?
Comment #66
Dig1 CreditAttribution: Dig1 commentedUPDATE
Just to let you know that I just setup Drupal with:
- Drupal core 7.0 LAMP
- Pathauto 7.x-1.x-dev (2011-Jan-28)
- Token 7.x-1.x-dev (2011-Feb-01)
and then applied the patch from #18 above to the token module and it worked fine.
Cheers
Dig
Comment #67
elachlan CreditAttribution: elachlan commentedWhat about a middle ground, [node:active:term]. So that its only published nodes. Not sure what to do in the case of an unpublished node though. Maybe have a safe default.
Otherwise you will have to change the taxonomy system or seed unpublished node taxonomy data into your own table.
Comment #68
elachlan CreditAttribution: elachlan commentedStumbled across this issue, thought it might help.
http://drupal.org/node/962664
Apparently unpublished nodes DO have Taxonomy data, but you can not get it by name? (that's my understanding of it, I could be wrong).
Comment #69
daviesap CreditAttribution: daviesap commented+1
Comment #70
smbell CreditAttribution: smbell commentedsubscribe
Comment #71
mikejonesok CreditAttribution: mikejonesok commentedIs there going be an official release soon? I keep getting a message to update token. Thanks for the patch!
Comment #72
kumkum29 CreditAttribution: kumkum29 commentedHello,
After editing the file token.tokens.inc I get a blank page for the site configuration. The patch does not work. (after update.php and clear cache)
Can you tell me why or you can make available the new file token.tokens.inc.
Thank you.
- Drupal core 7.0
- Pathauto 7.x-1.x-dev (2011-Jan-28)
- Token 7.x-1.x-dev (2011-Feb-25)
Comment #73
kumkum29 CreditAttribution: kumkum29 commentedit's ok for the patch ;)
Comment #74
sebish CreditAttribution: sebish commentedSubscribe
Comment #75
awasson CreditAttribution: awasson commentedSubscribe
Thanks to Dave Reid for the patch on #18. It worked like a charm : )
Comment #76
RavenHursT CreditAttribution: RavenHursT commentedPatch in #18 works GREAT... Thanks!!! Why in the world hasn't this been checked into HEAD yet?!?!
Comment #77
elachlan CreditAttribution: elachlan commentedSee #46 apparently unpublished nodes do not have taxonomy entries.
http://drupal.org/node/962664 might be useful in solving this.
Comment #78
georgedamonkey CreditAttribution: georgedamonkey commentedsubscribe
Comment #79
Dave ReidYes #962664: Taxonomy Index for unpublished entities would definitely make me feel better about committing this 'easy' token for people since proper field tokens is much harder.
Comment #80
tarheeldev CreditAttribution: tarheeldev commentedsubscribe
Comment #81
Dave ReidI can work around this for now by inserting these values into the table myself, but I'm not sure what repercussions there would be with other modules.
Comment #82
vivefree CreditAttribution: vivefree commented#18: 741914-token-node-term-D7.patch queued for re-testing.
Comment #83
wernercd CreditAttribution: wernercd commentedHand edited token.tokens.inc. Works fine so far. Please push to module soon... I dont' wanna be scurd of patching :/
Comment #84
inversed CreditAttribution: inversed commentedsubscribe
Comment #85
jviitamaki CreditAttribution: jviitamaki commentedsub
Comment #86
framewerx CreditAttribution: framewerx commentedsubscribe
Comment #88
EJvL CreditAttribution: EJvL commentedI also expected this to be part of the main Token module. Until that happens, you can consider using the Entity tokens module, provided as part of the Entity API module. See also #1155512: Using Taxonomy term tokens. This solved my problems...
(D6 note: in D6, similar functionality was provided by the Taxonomy token module)
Comment #89
creatile CreditAttribution: creatile commentedHi
I am working on Drupal 7
I need to add a taxonomy term for a content type in custom breadcrumbs and pathauto with the following pattern:
taxonomy parent / taxonomy term / node title.
How can I do that ? do I need the term:node feature that you request ?
Comment #90
melonkernel CreditAttribution: melonkernel commentedsubscribe
Comment #91
ILLIA CreditAttribution: ILLIA commentedsubscribe
Comment #92
creatile CreditAttribution: creatile commentedI found that I could use taxonomy terms in custom breadcrumbs and pathauto like this:
[node:field_name_of_field:name] for term
or
[node:field_name_of_field:parent] for parent term
or
[node:field_name_of_field:name:url:alias] for url alias of a term
These are already available as tokens
Comment #93
andrenoronha CreditAttribution: andrenoronha commentedSubscribe!
Comment #94
elachlan CreditAttribution: elachlan commented@#92 - What version of Drupal are you using? I cannot use these terms in content paths.
Comment #95
andrenoronha CreditAttribution: andrenoronha commented@#94 @#92 Neither could I!
Comment #96
sebish CreditAttribution: sebish commented#92 works perfectly well. Thanks Creatile. No need of using [node:term] anymore and I can finally update the token module without patching it everytime. For info, I'm using drupal 7.2, Token 7.x-1.0-beta2, Entity API 7.x-1.0-beta8.
Comment #97
andrenoronha CreditAttribution: andrenoronha commentedI'm using the same versions but without success.
I got the message: The Pattern for all .... paths is using the following invalid tokens: [node:field_canal:name].
same with [node:field_field_canal:name].
it's a term field.
Comment #98
ILLIA CreditAttribution: ILLIA commentedHey, if it helps someone to create custom URL aliases using taxonomy terms you can check out my comment at http://drupal.org/node/1044980 on June 6.
Comment #99
andrenoronha CreditAttribution: andrenoronha commented@98 thank you!! now i got it right.
it's not field_name_of_the_field
it's field-name_of_the_field
and it's seachable at the replace patterns below the url config form.
:)
Comment #100
creatile CreditAttribution: creatile commentedYou are right I made a mistake. So the right way is
[node:field-name-of-field:name] for term
or
[node:field-name-of-field:parent] for parent term
or
[node:field-name-of-field:name:url:alias] for url alias of a term
You can find them as token pattern replacement
Comment #101
scott.whittaker CreditAttribution: scott.whittaker commentedsubscribe
Comment #102
Dig1 CreditAttribution: Dig1 commentedCall me simple...but I am not sure what the problem is...all I am looking for is the ability to create node URLs from taxonomy terms and node title. The patch in #18 gives me that.
FYI (as per #31 and #66) I have been using it for a while with different builds of the Token module, it seems to work fine for me. Surprisingly it used to be marked as working and now it has changed to not working for some reason...anyway I just patched again today and everything continues :)
I am using: Drupal 7.2, Administration menu 7.x-3.0-rc1, Pathauto 7.x-1.0-rc2, Taxonomy Manager 7.x-1.x-dev (2011-Mar-25), Token 7.x-1.x-dev (2011-Jun-12).
Cheers
Dig
Comment #103
luco CreditAttribution: luco commentedsubs. :]
Comment #104
truls1502subscribe
Comment #105
kevinquillen CreditAttribution: kevinquillen commentedThe patch from #18 will not apply for me.
Comment #106
awasson CreditAttribution: awasson commentedI used the patch in #18 and it did work however whenever you update the module you have to repatch so instead I followed the instructions for using Entity API in #98 and it worked perfectly. No more patching.
Comment #107
phpleb CreditAttribution: phpleb commented#18: 741914-token-node-term-D7.patch queued for re-testing.
Comment #109
Dig1 CreditAttribution: Dig1 commentedYes, I reckon entity api is the way to go...
Well I finally got a bit fed-up with patching Token each time a new version released.
So I thought I'd swallow my reservations about looking at yet another module and decided to investigate this 'entity stuff'. http://www.istos.it/blog/drupal/drupal-entities-part-1-moving-beyond-nodes is a great post.
So I figured I'd install the entity module and then found to my surprise that it was already installed and enabled (VBO needs it...that must have just slipped by me :o)
So I looked for replacement patterns and there staring at me was [node:field-tags:name]. I replaced [node:term] with [node:field-tags:name] and everything in the garden is now rosy. Quelle surprise!
Dig
Comment #110
artatac CreditAttribution: artatac commentedI have entity api and entity tokens enabled but when I go to /admin/config/search/path/patterns > Pattern for all Article paths and add [node:field-tags:name]/[node:title] I get an error
[The Pattern for all Article paths is using the following invalid tokens: [node:field-tags:name].]
Is there another step needed please
Comment #111
hynnot CreditAttribution: hynnot commentedThe same of artatac.
Suscribe +1
Comment #112
Dig1 CreditAttribution: Dig1 commented#110 OK, it depends on the name of the taxonomy vocabulary you have installed. I reckon the best thing for you to do is go to admin/config/search/path/patterns and then click on the 'Replacement Patterns' to see what the system is making available to you...
Look at the Nodes section and you should find your taxonomy stuff in there. Maybe your taxonomy vocabulary is not called 'tags' but something else...
Post back how it goes. Cheers.
Comment #113
artatac CreditAttribution: artatac commentedThat is the point - despite using all the latest dev releases, I never get any taxonomy path settings at all. See attached screen shot.
Comment #114
Dig1 CreditAttribution: Dig1 commentedHmm, dunno if this is the place to discuss this issue...but lets check the basics. D7 comes with tags as the default empty vocabulary. Questions:
1) Have you added terms to that, or any, vocabulary?
2) Do your content types have a term-reference field that uses that, or any, vocabulary?
3) have you created nodes that contain vocabulary terms in term-reference fields?
Comment #115
artatac CreditAttribution: artatac commentedusing the default vocab
yes have added terms
yes terms have been used in articles
just a thought - do you have to limit terms to i or can they be unlimited?
Comment #116
Karol Haltenberger CreditAttribution: Karol Haltenberger commentedIs your taxonomy field multi-value?
The tokens do not get generated for those.
Comment #117
artatac CreditAttribution: artatac commentedThat was the issue - thanks for your feedback. Now I have set tags field to have only 1 value and have set the pattern to
[node:field-tags:parent:root:name]/[node:field-tags:parent:name]/[node:field-tags]/[node:title]
I get the url I need eg
http://localhost/acquia02/fruit/orange/jamaican-orange/jamaican-orange32
Shame there is not a single term like term-path rather than have to use three terms
Comment #118
droplet CreditAttribution: droplet commentedSuscribe +1
Comment #119
Dig1 CreditAttribution: Dig1 commented#117 so Joe it looks like you are finally sorted...have yourself a beer :)
Comment #120
georgedamonkey CreditAttribution: georgedamonkey commentedWow... thank you so much Dig1, Entity worked fantastic!
Comment #121
sharifudinrizal CreditAttribution: sharifudinrizal commented#117 works fine, as long as the term is no more than 3 levels deep.
e.g.
term 1 (root)
- term 2 (parent)
-- term 3 (term)
So it becomes /term-1/term-2/term-3/title
If we place the node in the 4th level down, it breaks:
term 1 (root)
- term 2 (parent?)
-- term 3 (parent)
--- term 4 (term)
We'll get /term-1/term-3/term-4/title.
term 2 is skipped, because it's not the current parent of the term.
Am I correct in this analysis?
Comment #122
Dave ReidBasic field tokens are now available in 7.x-1.0-beta4. Eventually you should be able to use more detailed tokens as part 2 of the effort with #691078: Field tokens.
But basically since terms are now fields, aside from supporting them in field tokens, we are not adding a [node:term] token. This is due to problems that the token needs to work in the same way if a node is unpublished or not - and this is not possible due to core's use of the {taxonomy_index} table.
Note that we did implement a [node:terms] token in http://drupal.org/project/taxonomy_entity_index.
Comment #123
vlacatocc CreditAttribution: vlacatocc commentedI've managed to get the urls for the products on my Drupal 7 webshop built up with their full taxonomy path, regardless of how many terms there are in the hierarchy. This solves the issue mentioned in post #121 where the hierarchy could only contain exactly 3 terms.
To get this to work, I've created a module that generates a few extra tokens which can be used with modules like pathauto or page_title. The module has dependencies to 'taxonomy', 'pathauto' and 'custom_breadcrumbs_taxonomy'.
The code is quite ugly for now as I only just got it working and I didn't have the time to clean it up yet.
Anyway, here goes:
tom.info:
tom.module
note: I'm omitting the root term in these examples because I'm using that as a means to differentiate the terms for different languages.
note 2: Again, I'm sorry for the ugly code. I need to make some time to clean it up. For now, I'm just happy I finally got this to work, after many months of breaking my head about this issue! ;)
This results in 4 additional tokens, 2 for the node pages and 2 for the term pages (both times one aimed for the page title and one aimed for the url).
In page title I now have the following tokens set:
Content Type - Product Display: [node:title] | [node:term-path-title] | [site:name]
Results in something like: 'My Product | Category A.1.2 | Category A.1 | Category A | Site name'
Vocabulary - Catalog: [term:term-path-title] | [site:name]
Results in something like: 'Category A.1.2 | Category A.1 | Category A | Site name'
In pathauto the equivalent tokens are:
Product display paths: [node:term-path]/[node:title]
Results in something like: '.../category-a/category-a-1/category-a-1-2/my-product'
Catalog paths: [term:term-path]
Results in something like: '.../category-a/category-a-1/category-a-1-2'
I hope this example can give people some ideas. :)
Oh yes, almost forgot... The module versions I'm using are:
Core: v7.8
Page Title: v7.x-2.5
Path Auto: v7.x-1.0-rc2
Custom Breadcrumbs: v7.x-2.x-dev (2011-Sep-06)
EDIT: On second thought, I could probably get away with removing the dependency to Custom Breadcrumbs. But I'm using that module anyways to achieve a similar behaviour as the one I want for the paths and the page titles, but for the breadcrumb instead (e.g. 'Home > Catalog > Category A > Category A.1 > Category A.1.2 > My Product').
Comment #124
jcamfield CreditAttribution: jcamfield commentedTo clarify "'First taxonomy term [node:term] The lowest-weighted taxonomy term associated with the node from the lowest-weighted vocabulary.'"
That pulls the topmost term in the global taxonomy term list from the bottom-most Taxonomy field on the content-type's Manage Fields (NOT display) -- not the highest/lowest weight.
I'd suggest it should take it from the first-listed vocab, but regardless, this is exactly the tool I was looking for for sane SEO paths from pathauto/token!
Comment #125
bancarddata CreditAttribution: bancarddata commentedvlacatocc,
I have tried so many patches, modules, and token combinations and finally I come to something that just works as I need it to. Thank you so much for posting your solution! I am pretty sure it will only be needed temporarily, but how long "temporarily" will end up being is anyone's guess.
Thanks!
Comment #126
2phaThanks vlacatocc,
saved me a lot of time.
Comment #127
sabeeln CreditAttribution: sabeeln commented#18: 741914-token-node-term-D7.patch queued for re-testing.
Comment #130
roadie_jay CreditAttribution: roadie_jay commentedHi.
Thanks very much for providing this module. I am trying to implement it on a d6 to d7 conversion. It works for the most part except that the parent terms are not included in the node's pathauto generated url. Any idea why this would be the case?
Solution found - the top level term is omitted from the url. I just added a single term below the root and made all the previous top level terms children of it. Paths look great now.
Comment #131
Dave ReidComment #132
klonos@Dave Reid: Hey Dave, I'm coming from #691078: Field tokens that is related, but locked because it reached 500+ comments. Still there's no update there for some time and unfortunately there is no easy way to "follow" (as in subscribe) to g.d.o yet. So, can you please give us a status update?
Also, please unlock #691078: Field tokens. People that don't want to be annoyed by updates to that issue can easily unfollow. Alternatively, we could open a new issue, add the summary of #691078: Field tokens and point people from #691078: Field tokens to it. Thank you in advance for considering this one.
Comment #133
protools CreditAttribution: protools commentedentity token Does what you need
http://www.computerminds.co.uk/drupal-code/entity-token
Comment #134
internets CreditAttribution: internets commentedHmm I've tried the patch in #18 and the token module supplied in #52.
The patch failed against the latest dev version of the token module. (7.x-1.x-dev Oct-1-2013)
Using the modules supplied in #52, installed module and cleared cache. Still did not see new replacement patterns.
I just want to recreate the Replacement Pattern functionality of [vocab-raw] and [term-raw] in Drupal 7. Are there any other solutions out there?
Comment #135
Dig1 CreditAttribution: Dig1 commentedThe Entity token module is part of the Entity package of modules, it provides lots of new tokens to use everywhere that tokens are currently available. It does this by being aware of the structure of fields on entities and exposing extra options for fields that reference entities. For example, it allows you to use many more tokens about taxonomy terms added to content. Read more at http://www.computerminds.co.uk/drupal-code/entity-token.
Comment #136
DamienMcKennaRequiring the Entity module to display tokens for fields provided by core is a little silly.
Comment #137
SolasArd CreditAttribution: SolasArd commentedIs there any solution for a similar problem in D6?