function civicrm_entity_price_set_field_field_load in CiviCRM Entity 7.2
Implements hook_field_load().
Parameters
$entity_type:
$entities:
$field:
$instances:
$langcode:
$items:
$age:
File
- modules/
civicrm_entity_price_set_field/ civicrm_entity_price_set_field.module, line 223
Code
function civicrm_entity_price_set_field_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
if ($entity_type == 'civicrm_event' || $entity_type == 'civicrm_contribution_page') {
foreach ($entities as $entity_id => $entity) {
$query = db_select('civicrm_price_set_entity', 'pce');
$price_set_id = $query
->fields('pce', array(
'price_set_id',
))
->condition('entity_table', $entity_type)
->condition('entity_id', $entity_id)
->execute()
->fetchField();
if (!empty($price_set_id)) {
$items[$entity_id][0]['price_set_id'] = $price_set_id;
}
else {
$items[$entity_id][0]['price_set_id'] = 0;
}
}
}
}