You are here

function notifications_tags_notifications_subscription in Notifications 7

Same name and namespace in other branches
  1. 6.4 notifications_tags/notifications_tags.module \notifications_tags_notifications_subscription()

Implementation of hook notifications_subscription()

File

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

Code

function notifications_tags_notifications_subscription($op, $subscription = NULL, $account = NULL) {
  switch ($op) {
    case 'page objects':

      // Return objects on current page to which we can subscribe
      $objects = array();
      if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && ($term = menu_get_object('taxonomy_term', 2))) {
        $objects[] = notifications_object('taxonomy_term', $term);
      }
      elseif (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'taxonomy' && arg(3) && ($vocabulary = menu_get_object('taxonomy_vocabulary_machine_name', 3))) {
        $objects[] = notifications_object('taxonomy_vocabulary', $vocabulary);
      }
      return $objects;
  }
}