You are here

function field_test_field_formatter_prepare_view in SimpleTest 7

Implement hook_field_formatter_prepare_view().

File

tests/field_test.module, line 577

Code

function field_test_field_formatter_prepare_view($obj_type, $objects, $field, $instances, $langcode, &$items, $build_mode) {
  foreach ($items as $id => $item) {

    // To keep the test non-intrusive, only act on the
    // 'field_test_needs_additional_data' formatter.
    if ($instances[$id]['display'][$build_mode]['type'] == 'field_test_needs_additional_data') {
      foreach ($item as $delta => $value) {

        // Don't add anything on empty values.
        if ($value) {
          $items[$id][$delta]['additional_formatter_value'] = $value['value'] + 1;
        }
      }
    }
  }
}