You are here

function commerce_price_table_field_load in Commerce Price Table 7

Implements hook_field_load().

File

./commerce_price_table.module, line 173

Code

function commerce_price_table_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {

  // Convert amounts to their floating point values and deserialize data arrays.
  foreach ($entities as $id => $entity) {
    foreach ($items[$id] as $delta => $item) {

      // Unserialize the data array if necessary.
      if (!empty($items[$id][$delta]['data'])) {
        if (is_string($items[$id][$delta]['data'])) {
          $items[$id][$delta]['data'] = unserialize($items[$id][$delta]['data']);
        }
      }
      else {
        $items[$id][$delta]['data'] = array(
          'components' => array(),
        );
      }
    }
  }
}