You are here

function notifications_content_notifications_object_node in Notifications 7

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_notifications_object_node()

Implementation of hook_notifications_object_node()

File

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

Code

function notifications_content_notifications_object_node($op, $node, $account = NULL) {
  switch ($op) {
    case 'subscription types':
      return array(
        'content_thread',
        'content_type',
      );
    case 'subscriptions':

      // Return available subscription options for this node and this user account
      $options = array();

      // Thread
      if (notifications_content_type_enabled($node->type, 'content_thread')) {
        $options[] = notifications_subscription('content_thread')
          ->set_node($node)
          ->set_name(t('This post'));

        // @todo this name should be in page objects
      }

      // Content type subscriptions
      if (notifications_content_type_enabled($node->type, 'content_type')) {
        $options[] = Notifications_Subscription::build_instance('content_type')
          ->set_node($node)
          ->set_name(t('Posts of type @type', array(
          '@type' => node_type_get_name($node),
        )));
      }
      return $options;
      break;
  }
}