1 node_type_example.module node_type_example_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display)

Implements hook_field_formatter_view().

@todo Provide a formatter for the colors.

Related topics

File

modules/examples/node_type_example/node_type_example.module, line 178
Hook implementations for the Node Type Example module.

Code

function node_type_example_field_formatter_view($object_type, $object, $field, $instance, $langcode, $items, $display) {
  $element = array();

  if ($display['type'] == 'node_type_example_colors') {
    foreach ($items as $delta => $item) {
      $element[$delta]['#type'] = 'markup';
      $color = $item['safe_value'];
      $element[$delta]['#markup'] = theme('node_type_example_color', array('color' => $color));
    }
  }

  return $element;
}