Advanced Entity Tokens
This project is not covered by Drupal’s security advisory policy.
Advanced Entity Tokens (AET) Creates a Token for each of your entity items.
Through AET you can query the DB for entities using Tokens.
[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>: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 (
- I'm saving this spot for real life examples other Drupal users had (or thought of having) for this module.
- 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.
- 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).
- 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.
|7.x-1.0-beta2||tar.gz (16.66 KB) | zip (20.16 KB)||2013年5月15日||发布说明||简 | 繁 | 更多|
|7.x-1.x-dev||tar.gz (17.03 KB) | zip (21.06 KB)||2014年9月9日||发布说明||简 | 繁 | 更多|