Currently RoleReference does not fully support CCK Field Tokens since there is no hook_token_list and hook_token_values functions. I need these for a project and wrote up an "Add-on" module to support these. Thought I'd give back to the community here.
Integrate it into the code, add it as a contributed sub mod, or just let people DL it from this issue... enjoy.
Here's the README file...
WHAT IT DOES:
-------------
This is an add-on module for the rolenodereference module that add
support for CCK field tokens. Once installed, Role Reference fields will
appear all places that other CCK field tokens appear. E.g., URL aliases,
Views arguments, views attach arguments, and the like.
For each field in your content types, there will be four types of tokens. For
example, if a content type has a role reference field named, field_roles,
the following tags will appear:
[field_roles_rid] => First / Single role id value in this field.
[field_roles_role] => First / Single role name value in this field.
[field_roles_rid-all] => All roleid separated by a "+" (views "or" operator)
[field_roles_role-all] => All role names separated by a comma.
Note that -all tokens are themeable by overriding the 'rolereference_tokens_all'
function.
This is based on the current CCK implimentation of nodereference field tokens
as done in content.token.inc, plus part of the new enhancements suggest in:
http://drupal.org/node/156860
TO INSTALL:
-----------
Normal install.
Install and enable the rolereference module first
(http://drupal.org/project/rolereference)
Put the rolereference_tokens folder into the 'modules'
directory of your Drupal installation.
Enable it.
BUGS & ISSUES:
--------------
http://drupal.org/project/issues/rolereference
| Comment | File | Size | Author |
|---|---|---|---|
| rolereference_tokens.zip | 8.17 KB | cgmonroe |
Comments
Comment #1
berenddeboer commentedThanks cgmonroe, added to latest dev version. Haven't personally tested it, so if you please could?
Comment #2
cgmonroe commentedThanks for the quick follow up.
One minor correction to the -dev code (that was my fault).
On line 933, remove the statement:
I left a log4drupal module debug statement in. This will probably cause a function not found error for everyone else.
Comment #3
berenddeboer commentedThanks, committed.