If multiple terms exist, provide a token for all terms selected (all, or all in a vocab)

doublejosh - February 20, 2008 - 23:01
Project:Token
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

Thanks for the new features!

I set of of my content types to use [title] -- term-raw] as it's page title. I've noticed that [vocab] is also valid.

However, these only return one term or category. Is there a way to return multiple terms, all terms, all terms in a category?

[title] - [author_name] - [term:1] etc.

Perhaps I just don't know token well enough?

#1

doublejosh - February 20, 2008 - 23:07

I should be made clear that this is a multiple values taxonomy term.

#2

nicholasThompson - February 21, 2008 - 09:57
Component:Documentation» Code
Status:active» by design

This is actually not an issue with Page Title, its more of an issue with Token. When you do a token_replace in the node 'scope' it will invoke the node_token_values function in this file...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/token/token...

Note how it only works out the term information for the token for ONE term (it does a break; at the end of one foreach loop).

So, to solve this you really need to speak to Jeff Eaton and either submit a patch to Token OR pay Jeff to fix it ;-)

Also, you're idea of "[term:1]" works fine if you KNOW that all nodes will have a a term at that index... I think maybe an addition of a token [all-terms] might be better?

Alternatively, you could write your own module which implements the Token API in the same way that Page Title does (I believe its the last two functions in the module, off the top of my head).

#3

Summit - March 6, 2008 - 11:06

Hi Josh,

Also interested in this functionality!

greetings,
Martijn

#4

Summit - May 26, 2008 - 15:32

Couldn't the solution be to have the first term (in hierarchy; using the needed term-depth) from a specific vocabulary, is that doable?

greetings,
Martijn

#5

nicholasThompson - May 26, 2008 - 18:10
Project:Page Title» Token
Version:5.x-2.0-alpha5» 5.x-1.x-dev
Category:support request» feature request
Priority:normal» minor
Status:by design» active

I think this really falls into a feature request for Token. Could Token either implement the [term-raw:1] type token where the integer represents the term offset on the node (as suggested in comment #2)... Or maybe the number represents a filter on the vocab (could make more sense).... Or maybe depth (as suggested in comment #4)?!

Alternatively maybe it could be a contrib module that implements the Token API?

#6

greggles - June 19, 2008 - 20:20
Title:Multiple taxonomy terms» If multiple terms exist, provide a token for all terms selected (all, or all in a vocab)
Version:5.x-1.x-dev» 6.x-1.x-dev
Priority:minor» normal
Status:active» postponed

Correct - this is largely a duplicate of #185446: tokens for each vocabulary (not entirely, though, so I'll leave this postponed).

It could also be done in a contrib if someone wanted to, but note the performance concerns.

#7

mmilo - March 18, 2009 - 04:03

Will this fix (yes, I realize it's currently postponed) include multiple values for CCK fields? Or am I missing something?

For example I have a Node Reference CCK field that allows for multiple values, and the Token module will only give the [raw] values for the first value.

I didn't create a new issue as this one seemed close enough to my question.

Thanks.

#8

terry22 - October 21, 2009 - 15:19

@mmilo:
Did you fix the issue of Node Reference with multiples values and the corresponding token?

#9

mmilo - October 21, 2009 - 17:08

I'm afraid not.

I needed this functionality in conjunction with using the Rules module. What I ended up doing was writing some custom PHP code that would use node_load and iterate through the CCK field.

There might be a more elegant solution now (this issue is pretty old).

Good luck!

 
 

Drupal is a registered trademark of Dries Buytaert.