function merci_core_get_restrictions in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
File
- merci_core/
merci_core.module, line 92
Code
function merci_core_get_restrictions($product_id) {
$field_name = 'field_restrictions';
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'reservable_product_display')
->fieldCondition('field_crp_product_reference', 'product_id', $product_id);
$result = $query
->execute();
if (isset($result['node'])) {
$nids = array_keys($result['node']);
$nodes = entity_load('node', $nids);
$node = reset($nodes);
$langcode = 'und';
$tid = $node->{'field_resource_type'}[$langcode][0]['tid'];
$term = taxonomy_term_load($tid);
if (!empty($term->{$field_name})) {
return $term->{$field_name}[$langcode];
}
}
}