merci_inventory.module in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.2
Same filename and directory in other branches
Hooks and functions for MERCI Inventory
File
modules/merci_inventory/merci_inventory.moduleView source
<?php
/**
* @file
* Hooks and functions for MERCI Inventory
*/
/**
* @file
* Bulk export of objects generated by Bulk export module.
*/
/**
* Implement hook_ctools_plugin_api().
*/
function merci_inventory_ctools_plugin_api($module, $api) {
if ($module == 'field_group' && $api == 'field_group') {
return array(
'version' => 1,
);
}
}
/**
* Implementation of hook_node_info().
*/
function merci_inventory_node_info() {
return array(
// Inventory nodes.
'merci_inventory' => array(
'name' => t('Inventory'),
'module' => 'merci_inventory',
'base' => 'node_content',
'has_body' => TRUE,
'description' => t("An Inventory node contains a simple list of other nodes."),
'locked' => TRUE,
),
// Inventory Master nodes.
'merci_inventory_master' => array(
'name' => t('Inventory Master'),
'base' => 'node_content',
'module' => 'merci_inventory',
'has_body' => FALSE,
'description' => t("Add additional CCK fields to the Inventory Master content type to synchronize to other MERCI managed content types."),
'locked' => TRUE,
),
);
}
/**
* Implementation of hook_node_operations().
*/
function merci_inventory_action_info() {
return array(
'merci_inventory_operations_update' => array(
'type' => 'node',
'label' => t('Confirm Selected Items Are Currently in Inventory'),
'configurable' => FALSE,
'aggregate' => TRUE,
),
);
}
/**
* Callback function for adding items to new merci_inventory node.
*/
function merci_inventory_operations_update($objects, $context = array()) {
global $user;
// Construct the new node object.
$node = new stdClass();
$node->title = 'Inventory - ' . format_date(time(), $type = 'small');
$node->type = 'merci_inventory';
$node->language = 'und';
$node->uid = $user->uid;
foreach (array_keys($objects) as $nid) {
$target = array(
'target_id' => $nid,
);
$node->field_merci_inventory_item[$node->language][] = $target;
}
$node = node_submit($node);
node_save($node);
$node_link = l($node->title, 'node/' . $node->nid);
$watchdog_args = array(
'@type' => $node->type,
'!title' => $node_link,
);
$t_args = array(
'@type' => node_type_get_name($node),
'!title' => $node_link,
);
if ($node->nid) {
watchdog('content', '@type: added !title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
drupal_set_message(t('@type !title has been created.', $t_args));
}
}
/**
* Implementation of hook_views_api().
*/
function merci_inventory_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'merci_inventory'),
);
}
Functions
Name | Description |
---|---|
merci_inventory_action_info | Implementation of hook_node_operations(). |
merci_inventory_ctools_plugin_api | Implement hook_ctools_plugin_api(). |
merci_inventory_node_info | Implementation of hook_node_info(). |
merci_inventory_operations_update | Callback function for adding items to new merci_inventory node. |
merci_inventory_views_api | Implementation of hook_views_api(). |