You are here

function signaturefield_field_formatter_view in SignatureField 7

Same name and namespace in other branches
  1. 7.2 includes/field.inc \signaturefield_field_formatter_view()

Implements hook_field_formatter_view().

Two formatters are implemented.

  • field_example_simple_text just outputs markup indicating the color that was entered and uses an inline style to set the text color to that value.
  • field_example_color_background does the same but also changes the background color of div.region-content.

See also

signaturefield_field_formatter_info()

File

includes/field.inc, line 95
Content module integration.

Code

function signaturefield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {

    // This formatter simply outputs the field as text and with a color.
    case 'signaturefield_formatter':
      foreach ($items as $delta => $item) {
        $element[$delta] = array(
          '#markup' => theme('signaturefield_display', array(
            'data' => $item['data'],
            'settings' => $instance['widget']['settings'],
          )),
        );
      }
      break;
  }
  return $element;
}