You are here

function field_test_field_load in SimpleTest 7

Implement hook_field_load().

File

tests/field_test.module, line 406

Code

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

    // To keep the test non-intrusive, only act for instances with the
    // test_hook_field_load setting explicitly set to TRUE.
    if ($instances[$id]['settings']['test_hook_field_load']) {
      foreach ($item as $delta => $value) {

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