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]).
  • Using taxonomy to manage your images and then using AET & token_filter to print it in various text fields.
  • I'm saving this spot for real life examples other Drupal users had (or thought of having) for this module.

AET Insert

This feature is only available in the Drupal 7 version. If you'd like to see it come back in Drupal 8+, please create an issue (and ideally provide a patch).

  1. AET Insert is a UI tool built to allow content managers to use AET tokens.
  2. After enabling the module you will need to navigate to any text field edit page
    and click the AET Insert checkbox.
  3. The AET Insert field adds a very simple filtering for AET.

Installing

  1. Download the AET module file below.
  2. Unpack it in your modules folder.
  3. Enable the AET module in your Drupal site.
  4. 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

  • Stability
    Please see #3162284: Stable release roadmap.
  • Entity Recursion
    Recursion is always a risk when writing a module such as mine. I think I handled all of the recursion issues (tested against the page being viewed & the function backtrace). Of course the more installs & tests this module receives the better it gets.
Supporting organizations: 
Refactoring for Drupal 8+, maintenance and new features

Project information

Releases