/** * Implements hook_field_formatter_info(). */ function _field_formatter_info() { return array( '_name; ?>' => array( 'label' => t('label; ?>'), 'field types' => array('field_types)); ?>'), ), ); } /** * Implements hook_field_formatter_view(). */ function _field_formatter_view($obj_type, $object, $field, $instance, $langcode, $items, $display) { $element = array(); $pattern = "code); ?>"; $info = token_get_info("{$field['type']}-field"); $field_value = $info['field-value-type']; $output = ''; foreach ($items as $item) { $output .= token_replace($pattern, array( $obj_type => $object, $field_value => $item, 'item' => $item, )); } $element[0] = array( '#markup' => $output, ); return $element; }