Hi,

I am posting to enquire what the possibilities are for a new token to be exposed via the Entity Tokens system.

I have a site with content sorted by term/taxonomy, the site is structured to reflect this tree however I have a quite deep tree, for example consider the term tree (My term relation filed is called field_term for example purposes):

Animals
- Vertibrates
- - Mammals
- - - Flying
- - - Walking
- - - Swimming
- - - - Large
        NODE: Whale
        NODE: Manatee
- - - - Small
- - Fish
- - Birds
- Invertibratres
- - Arachnids
- - Insects

Consider the Whale node.
using [node:field_term} gets me 'Large'
using [node:field_term:parent] gets me 'Swimming'
using [node:field_term:root] gets me 'Animal'.

But I can't get to 'Mammals' or 'Vertibrates' !

I would like to see, if possible, a new token with the suggested title of [node:field_term:parents] that would return all the parents up to root, in the example above on the whale node...

[node:field_term:parents] = Vertibrates/Mammals/Swimming

I have been looking at alot of solution talk for taxonomy paths for content with pathauto, and it seems quite a few are looking for this functionality. Therefor I make this feature request here, let me know if I'm 'barking up the wrong tree'!

Being a programmer I am happy to contribute, however I skimmed the entity modules code and it looks complex and I would be adverse to guessing where to start!

I am using entity (entity-7.x-1.0-beta10) and tokens (token-7.x-1.0-beta4) in the context of pathauto (pathauto-7.x-1.0-rc2) on Drupal7.7.

Thanks for taking the time to read!

Comments

dave reid’s picture

Would a [term:parents] which contains all the parents including root work for your case? See #1266928: Add [term:parents] and [menu-link:parents] array tokens

ZuluWarrior’s picture

Yea, the goal is to work up the tree any which way basically :)

I only mention my method in regard to terms and because Drupal 7 defines a term reference via a field, and because you can have multiple selections in multiple term reference fields it makes more sense structurally to group via the field name.

Don't hold me to it but as I recall I read somewhere that fago's not going to develop other taxonomy tokens in favor of extending the field tokens objects as well.

But any ways a winner in my book! I'm somewhat impartial to the other tokens you suggest as for me I'm only (currently) using tokens for url path related stuff, but the menu-links one sounds interesting! :)

fago’s picture

Status: Active » Closed (duplicate)
ZuluWarrior’s picture

Status: Closed (duplicate) » Active

Thanks for the response fage, I read that thread, but Is it a duplicate?

My issue concerns a single value field, containing a term reference, that (in a hierarchical taxonomy structure) has parent terms.

Compared to a term reference that is set to 'multi-select' (as in free tag set up) am I not asking for something different?

array of ordered single term parents vs array of terms selected in the field?

Apologies if it does boil down to the same thing, please re-close this chain if i've missed the point I just wasn't sure if you'd see my reply/query if I left it closed...

fago’s picture

Status: Active » Closed (duplicate)

>Compared to a term reference that is set to 'multi-select' (as in free tag set up) am I not asking for something different?

Nope, it would be handled by the mentioned patch too. It's generally about properties with multiple values, as term parents are too.

ZuluWarrior’s picture

Thanks fago,

Apologies for shuffling the status, I'll review that thread :)