You are here

function computed_field_field_prepare_view in Computed Field 7

Implements hook_field_prepare_view().

File

./computed_field.module, line 304
Functionality for the computed field.

Code

function computed_field_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
  $settings = $field['settings'];

  // Compute field values in case user is "previewing" an entity.
  foreach ($entities as $etid => $entity) {
    if (isset($entity->op) && $entity->op == 'Preview' || $settings['recalculate']) {
      _computed_field_compute_value($entity_type, $entity, $field, $instances, $langcode, $items[$etid]);
    }
  }
}