function notifications_custom_load in Notifications 6.4
Same name and namespace in other branches
- 6 notifications_custom/notifications_custom.module \notifications_custom_load()
Load custom subscription type. Menu autoloading
Parameters
$key: It may be csid (integer) or type (string)
3 calls to notifications_custom_load()
- NotificationsCustomTests::createCustomFields in tests/
notifications_custom.test - Add fields to custom subscription
- NotificationsCustomTests::createCustomSubscription in tests/
notifications_custom.test - Create custom subscription through admin form
- notifications_custom_form_validate in notifications_custom/
notifications_custom.admin.inc - Validate subscription type. Just check for 'type' duplicates
1 string reference to 'notifications_custom_load'
- NotificationsCustomTests::createCustomFields in tests/
notifications_custom.test - Add fields to custom subscription
File
- notifications_custom/
notifications_custom.module, line 331 - Custom notifications module
Code
function notifications_custom_load($key) {
$cache =& messaging_static(__FUNCTION__);
if (!isset($cache[$key])) {
$where = is_numeric($key) ? 'csid = %d' : "type = '%s'";
$template = db_fetch_object(db_query('SELECT * FROM {notifications_custom} WHERE ' . $where, $key));
if ($template) {
$template->fields = !empty($template->fields) ? unserialize($template->fields) : array();
//$subscription = notifications_custom_build_subscription($template);
// Cache by type and id
$cache[$template->csid] = $template;
$cache[$template->type] = $template;
}
else {
$cache[$key] = FALSE;
}
}
return $cache[$key];
}