function notifications_tags_notifications_object_node in Notifications 7
Same name and namespace in other branches
- 6.4 notifications_tags/notifications_tags.module \notifications_tags_notifications_object_node()
Implementation of hook_notifications_object_node()
File
- notifications_tags/
notifications_tags.module, line 167 - Subscriptions to taxonomy terms
Code
function notifications_tags_notifications_object_node($op, $node, $account = NULL) {
switch ($op) {
case 'subscription types':
return array(
'taxonomy_term',
'taxonomy_term_multiple',
'content_type_term',
);
case 'conditions':
// For a queue query, when not account, we must use our own function to retrieve terms
$tids = notifications_tags_node_get_terms($node);
if (!empty($tids)) {
return array(
'tid' => $tids,
);
}
break;
case 'subscriptions':
// Get all available subscriptions to current node
$options = array();
if (notifications_subscription_type_enabled('taxonomy_term') && (!$account || user_access('subscribe to taxonomy terms', $account))) {
$vocabs = notifications_tags_vocabulary_enabled();
if ($vocabs && notifications_content_type_enabled($node->type, 'taxonomy_term') && ($terms = notifications_tags_node_terms($node))) {
foreach ($terms as $term) {
if (in_array($term->vid, $vocabs)) {
$options[] = notifications_subscription('taxonomy_term')
->add_term($term);
}
}
}
}
return $options;
}
}