You are here

function machine_name_field_formatter_view in Machine name 7

Same name and namespace in other branches
  1. 7.2 machine_name.module \machine_name_field_formatter_view()

Implements hook_field_formatter_view().

File

./machine_name.module, line 133
Defines a machine name field type, relying on Form API's #type 'machine_name'.

Code

function machine_name_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'machine_name_default':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#markup' => strip_tags($item['value']),
        );
      }
      break;
  }
  return $element;
}