You are here

function dimension_field_formatter_view in Dimension 7

Implements hook_field_formatter_view().

File

./dimension.module, line 255

Code

function dimension_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  $settings = $instance['settings'];
  switch ($display['type']) {
    case 'dimension_formatter':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#theme' => 'dimension_theme_table',
          '#mode' => $field['settings']['mode'],
          '#item' => $item,
          '#settings' => $settings,
        );
      }
      break;
    case 'dimension_formatter_simple':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#theme' => 'dimension_theme_simple',
          '#mode' => $field['settings']['mode'],
          '#item' => $item,
          '#settings' => $settings,
        );
      }
      break;
  }
  return $element;
}