Advanced Entity Tokens
Installs:
418
Open Bugs:
0
Development Status:
Seeking co-maintainer(s)
Maintenance fixes only
Advanced Entity Tokens (AET) Creates a Token for each of your entity items.
Through AET you can query the DB for entities using Tokens.
Examples
-
[aet:node:1]
will return the 1st node with the token view mode (or full if token is not available). -
[aet:file:1:view-original]
will return the 1st file entity with the original view mode. -
[aet:taxonomy_term:1:name]
will return the 1st node title field (note that this level of chaining is done by the formal token implementation of the node entity in token/token.tokens.inc -> token_token_info()).
Real World Examples
-
Displaying a node inside a block:
This could be done using Node Block OR you could insert a token inside a block you create through the Blocks interface that retrieves a certain node (or a property inside a node,[aet:node:<nid>]
or[aet:node:<nid>:body]
) with no extra code. -
Displaying a File Entity (image) inside a title field:
I'm not sure how this could have been done without custom code, BUT with AET you could easily insert the Token for a specific File Entity ([aet:file:<fid>]
) and your entity will be displayed. AET defaults to the Token view mode if available (full otherwise), but you could just as easily specify a view mode of your own ([aet:file:<fid>:view-teaser]
). - I'm saving this spot for real life examples other Drupal users had (or thought of having) for this module.
AET Insert
- AET Insert is a UI tool built to allow content managers to use AET tokens.
- After enabling the module you will need to navigate to any text field edit page
and click the AET Insert checkbox. - The AET Insert field adds a very simple filtering for AET.
Installing
- Download the AET module file below.
- Unpack it in your modules folder.
- Enable the AET module in your Drupal site.
- Enter one of the above examples in a Token supported field (I suggest installing Token Filter to enable token filtering in general text fields).
Required Modules
Recommanded Modules
Known Issues
- Entity Recursion:
Recursion is always a risk when writing a module such as mine. I think I handled all the recursion issues (tested aginst page being viewed & the function backtrace). Ofcurse the more installs & tests this module receives the better it gets.
An example use case of what the module can provide is using taxonomy to manage
your images and then using AET & token_filter to print it in varius text fields.
Releases:
7.x-1.0-beta2
7.x-1.x-dev
Release Dates:
05/14/2013
09/30/2013