function merci_load_item_settings in MERCI (Manage Equipment Reservations, Checkout and Inventory) 6.2
Same name and namespace in other branches
- 7.3 merci_migrate/merci_items.inc \merci_load_item_settings()
- 7.2 includes/api.inc \merci_load_item_settings()
9 calls to merci_load_item_settings()
- merci_add_reservation_items in includes/
api.inc - Adds items to reservation on creation/update.
- merci_add_settings_form in ./
merci.module - merci_check_content_type_restrictions in includes/
api.inc - Checks for reservation restrictions for a content type.
- merci_form_alter in ./
merci.module - Implementation of hook_form_alter().
- merci_import_2 in import/
merci_import.php - Add followup files.
File
- includes/
api.inc, line 975 - MERCI - Managed Equipment Reservation Checkout and Inventory
Code
function merci_load_item_settings($object) {
if (is_string($object)) {
$type = $object;
}
else {
$node = (array) $object;
$type = $node['type'];
}
$item_settings = array();
// Settings from the content type edit page.
$content_settings = merci_content_types($type);
if (empty($content_settings)) {
$content_settings = array();
}
if (isset($node) and $node['nid']) {
// Settings common to all merci item nodes.
// resource or bucket.
$merci_type = array_key_exists('merci_type_setting', $content_settings) ? $content_settings['merci_type_setting'] : 'disabled';
$vid = $node['vid'];
$item_settings = merci_reservation_item_node_settings($vid);
switch ($merci_type) {
case 'bucket':
// TODO: move to seperate module.
if ($item_settings['merci_sub_type'] == MERCI_SUB_TYPE_RESERVATION) {
unset($item_settings['merci_default_availability']);
unset($item_settings['merci_item_status']);
$item_settings += merci_bucket_node_settings($vid);
}
break;
case 'resource':
// TODO: move to seperate module.
$item_settings += merci_resource_node_settings($vid);
break;
}
}
if ($item_settings) {
return (object) ($item_settings + $content_settings);
}
else {
return (object) $content_settings;
}
}