function commerce_price_field_load in Commerce Core 7
Implements hook_field_load().
File
- modules/
price/ commerce_price.module, line 85 - Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.
Code
function commerce_price_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']) && !is_array($items[$id][$delta]['data'])) {
$items[$id][$delta]['data'] = unserialize($items[$id][$delta]['data']);
}
else {
$items[$id][$delta]['data'] = array(
'components' => array(),
);
}
}
}
}