You are here

function commerce_customer_field_formatter_view in Commerce Core 7

Implements hook_field_formatter_view().

File

modules/customer/commerce_customer.module, line 875
Defines the customer profile entity and API functions to manage customers and interact with them.

Code

function commerce_customer_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $result = array();
  switch ($display['type']) {
    case 'commerce_customer_profile_reference_display':
      foreach ($items as $delta => $item) {
        $profile = commerce_customer_profile_load($item['profile_id']);
        if ($profile) {
          $content = entity_view('commerce_customer_profile', array(
            $profile->profile_id => $profile,
          ), 'customer', $langcode);
          $result[$delta] = array(
            '#markup' => drupal_render($content),
          );
        }
      }
      break;
  }
  return $result;
}