You are here

function vcardfield_field_formatter_view in VCard Field 7

Implements hook_field_formatter_view().

File

./vcardfield.module, line 70

Code

function vcardfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'vcardfield_default':
      foreach ($items as $delta => $item) {
        if ($entity_type == 'node') {
          $item['nid'] = $entity->nid;
        }
        if ($entity_type == 'user') {
          $item['nid'] = $entity->uid;
        }
        $item['type'] = $entity_type;
        $item['delta'] = $delta;
        $element[$delta]['#markup'] = theme('vcardfield', $item);
      }
      break;
  }
  return $element;
}