You are here

function notifications_content_notifications_subscription in Notifications 6.4

Same name and namespace in other branches
  1. 7 notifications_content/notifications_content.module \notifications_content_notifications_subscription()

Implementation of hook notifications_subscription()

File

notifications_content/notifications_content.module, line 370
Subscriptions to content events

Code

function notifications_content_notifications_subscription($op, $subscription = NULL) {
  switch ($op) {
    case 'access':

      // Check access control for subscription
      if (($conditions = $subscription
        ->get_conditions()) && !empty($conditions['type'])) {

        // It seems to be a subscription for a content type
        return notifications_content_type_enabled($conditions['type'], $subscription->type);
      }
      break;
    case 'page objects':

      // Return objects on current page to which we can subscribe
      if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = menu_get_object('node'))) {
        return array(
          'node' => $node,
        );
      }
      break;
  }
}