You are here

function rolereference_field_formatter_view in Role Reference 7

Implements hook_field_formatter_view().

File

./rolereference.module, line 171

Code

function rolereference_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'rolereference_default':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#markup' => check_plain($item['role']),
        );
      }
      break;
    case 'rolereference_rid':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#markup' => check_plain($item['rid']),
        );
      }
      break;
  }
  return $element;
}