function _merci_content_type_info in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
Same name and namespace in other branches
- 6.2 merci.module \_merci_content_type_info()
- 7.3 merci_migrate/merci_items.inc \_merci_content_type_info()
1 call to _merci_content_type_info()
- merci_content_types in includes/
api.inc - Return a list of all merci content types.
File
- ./
merci.module, line 1001 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function _merci_content_type_info($reset = FALSE) {
static $info;
if ($reset || !isset($info)) {
if (!$reset && ($cached = cache_get('merci_content_type_info'))) {
$info = $cached->data;
}
else {
$info = array();
// Load MERCI node type settings.
$merci_settings = db_query("SELECT * FROM {merci_node_type} mt INNER JOIN {node_type} nt ON mt.type = nt.type WHERE merci_type_setting <> :merci_type_setting", array(
':merci_type_setting' => 'disabled',
));
// with the correct stuff..
foreach ($merci_settings as $merci_setting) {
$merci_setting = (array) $merci_setting;
$merci_setting['type_name'] = $merci_setting['name'];
$grouping = $merci_setting['merci_type_setting'] == 'resource' ? $merci_setting['type_name'] : t('Buckets');
$tid = variable_get('merci_grouping_' . $merci_setting['type'], 0);
if ($tid) {
$term = taxonomy_term_load($tid);
if ($term) {
$grouping = $term->name;
}
}
$merci_setting['merci_item_grouping'] = $grouping;
unset($merci_setting['name']);
$info[$merci_setting['type']] = $merci_setting;
}
cache_set('merci_content_type_info', $info);
}
}
return $info;
}