You are here

function notifications_tags_notifications_object_term in Notifications 6.4

Implementation of hook_notifications_object_term()

File

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

Code

function notifications_tags_notifications_object_term($op, $term, $account = NULL) {
  switch ($op) {
    case 'conditions':
      return array(
        'tid' => $term->tid,
      );
      break;
    case 'subscriptions':

      // Get all available subscriptions to current node
      $options = array();
      if (!$account || user_access('subscribe to taxonomy terms', $account)) {
        $vocabs = notifications_tags_vocabularies();
        if (notifications_content_type_enabled(NULL, 'taxonomy') && array_key_exists($term->vid, $vocabs)) {
          $options[] = array(
            'name' => t('Posts tagged with %name', array(
              '%name' => $term->name,
            )),
            'type' => 'taxonomy',
            'fields' => array(
              'tid' => $term->tid,
            ),
          );
        }
      }
      return $options;
  }
}