Last updated 17 March 2015. Created on 6 March 2015.
Edited by valderama. Log in to edit this page.

For a general introduction to the Entity Formatter module view its module page.

API Documentation

The full API Documentation can be found here:


Print the first value

  print $page->getImages()->setImageStyle('thumbnail')->img(); 

Print the first value (if present) with label

  if ($page->getImages()->isDeltaValid()) {
    print t('Images') . ':';
    print $page->getImages()->img();

Print all values

  foreach ($page->getImages() as $image) {
    print $image->setImageStyle('thumbnail')->img();

Print the third value

  if ($page->getImages()->isDeltaValid(3)) {
    print $page->getImages()->setDelta(3)->img();

Print first until third value (if present)

  $num_to_print = min(3, count($page->getImages()));
  for ($delta = 0; $delta < $num_to_print; $delta++) {
    print $page->getImages()->setDelta($delta)->img();


The module provides a single drush command "entity-formatter-make" or short "efm".

drush efm node --bundles=page,article --module=entity_formatter_custom

This example generates formatter classes for page and article node types and place them in the entity_formatter_custom module (generating module if not exists).

EntityFormatter_CheatSheet.pdf61.07 KB

Looking for support? Visit the forums, or join #drupal-support in IRC.