You are here

function notifications_tags_notifications_object_taxonomy_term in Notifications 7

Implements hook_notifications_object_taxonomy_term()

File

notifications_tags/notifications_tags.module, line 218
Subscriptions to taxonomy terms

Code

function notifications_tags_notifications_object_taxonomy_term($op, $term, $account = NULL) {
  switch ($op) {
    case 'subscription types':
      return array(
        'taxonomy_term',
        'taxonomy_vocabulary',
        'content_type_term',
        'taxonomy_term_multiple',
      );
    case 'conditions':
      return array(
        'term:tid' => $term->tid,
      );
    case 'subscriptions':

      // Get all available subscriptions to current node
      $options = array();
      if (notifications_tags_vocabulary_enabled($term->vid) && (!$account || user_access('subscribe to taxonomy terms', $account))) {
        $options[] = notifications_subscription('taxonomy_term')
          ->add_field('term:tid', $term->tid);
      }
      return $options;
  }
}