You are here

function blockreference_field_formatter_view in Block reference 7

Same name and namespace in other branches
  1. 7.2 blockreference.field.inc \blockreference_field_formatter_view()

Implements hook_field_formatter_view().

File

./blockreference.module, line 279
Defines a field type for referencing a block from a node.

Code

function blockreference_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $formatter = str_replace('blockreference_', '', $display['type']);
  foreach ($items as $delta => $item) {
    $element[$delta] = array(
      '#theme' => 'blockreference_formatter_' . $formatter,
      '#element' => array(
        'entity_type' => &$entity_type,
        'entity' => &$entity,
        'field' => &$field,
        'instance' => &$instance,
        'langcode' => &$langcode,
        'item' => $item,
        'display' => &$display,
      ),
    );
  }
  return $element;
}