You are here

function notifications_content_notifications in Notifications 7

Same name and namespace in other branches
  1. 5 notifications_content/notifications_content.module \notifications_content_notifications()
  2. 6.4 notifications_content/notifications_content.module \notifications_content_notifications()
  3. 6 notifications_content/notifications_content.module \notifications_content_notifications()
  4. 6.2 notifications_content/notifications_content.module \notifications_content_notifications()
  5. 6.3 notifications_content/notifications_content.module \notifications_content_notifications()

Implementation of hook_notifications()

1 call to notifications_content_notifications()
notifications_content_menu in notifications_content/notifications_content.module
Implementation of hook_menu_()

File

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

Code

function notifications_content_notifications($op) {
  switch ($op) {
    case 'subscription types':

      // Some types may be globally disabled (for all content types), mark as such
      $disabled = !variable_get('notifications_content_per_type', 0);
      $types['content_thread'] = array(
        'title' => t('Thread'),
        'class' => 'Notifications_Node_Subscription',
        'field_types' => array(
          'node:nid',
        ),
        'object_types' => array(
          'node',
        ),
        'access' => array(
          'subscribe to content',
        ),
        'description' => t('Subscribe to all changes and comments for a thread.'),
        'display_options' => array(
          'node_links',
          'teaser_links',
        ),
      );
      $types['content_type'] = array(
        'title' => t('Content type'),
        'class' => 'Notifications_Content_Subscription',
        'field_types' => array(
          'node:type',
        ),
        'object_types' => array(
          'node',
          'node_type',
        ),
        'access' => array(
          'subscribe to content type',
        ),
        'description' => t('Subscribe to all content of a given type.'),
        'display_options' => array(
          'node_links',
          'teaser_links',
        ),
      );
      return $types;
    case 'field types':
      $fields['node:type'] = array(
        'title' => t('Node type'),
        'class' => 'Notifications_Node_Type_Field',
      );
      return $fields;
    case 'object types':

      // Define object types for use by events and subscriptions
      // Node and user are defined in the main notifications module
      $types['comment'] = array(
        'title' => t('Comment'),
        'class' => 'Notifications_Comment',
      );
      $types['node_type'] = array(
        'title' => t('Content type'),
        'class' => 'Notifications_Node_Type',
      );
      return $types;
    case 'event types':
      $types['node-post'] = array(
        'object' => 'node',
        'action' => 'post',
        'title' => t('Node post'),
        'class' => 'Notifications_Node_Post_Event',
        'template' => 'notifications_content-node-insert',
        'triggers' => array(
          'node' => array(
            'node_publish',
            'node_insert',
            'node_update',
          ),
        ),
        'actions' => array(
          'notifications_content_node_post_action',
        ),
      );
      $types['node-update'] = array(
        'object' => 'node',
        'action' => 'update',
        'class' => 'Notifications_Node_Update_Event',
        'title' => t('Node update'),
        'template' => 'notifications_content-node-update',
        'triggers' => array(
          'node' => array(
            'node_update',
          ),
        ),
        'actions' => array(
          'notifications_content_node_update_action',
        ),
      );
      $types['node-comment'] = array(
        'object' => 'node',
        'action' => 'comment',
        'class' => 'Notifications_Node_Comment_Event',
        'title' => t('Node comment'),
        'template' => 'notifications_content-node-comment',
        'triggers' => array(
          'comment' => array(
            'comment_insert',
            'comment_update',
          ),
        ),
        'actions' => array(
          'notifications_content_comment_action',
        ),
      );
      return $types;
    case 'message templates':

      // Single node templates
      $types['notifications_content-node-insert'] = array(
        'object' => 'node',
        'title' => t('Node post'),
        'class' => 'Notifications_Node_Insert_Template',
      );
      $types['notifications_content-node-update'] = array(
        'object' => 'node',
        'title' => t('Node update'),
        'class' => 'Notifications_Node_Update_Template',
      );
      $types['notifications_content-node-comment'] = array(
        'object' => 'node',
        'title' => t('Node comment'),
        'class' => 'Notifications_Node_Comment_Template',
      );

      // Node listing templates
      $types['notifications_content-node_list'] = array(
        'object' => 'node_list',
        'title' => t('Node list titles'),
        'class' => 'Notifications_Content_Node_List',
      );
      $types['notifications_content-node_teasers'] = array(
        'object' => 'node_list',
        'title' => t('Node list teasers'),
        'class' => 'Notifications_Content_Node_Teasers',
      );
      if (module_exists('views')) {
        $types['notifications_content-node_view'] = array(
          'object' => 'node_list',
          'title' => t('Node list View'),
          'class' => 'Notifications_Content_Node_View',
          'view' => 'notifications_content_node_list',
        );
      }
      return $types;
    case 'display options':
      $options['node_links'] = array(
        '#title' => t('Full node links'),
        '#description' => t('Subscription links will be displayed for full node pages.'),
      );
      $options['teaser_links'] = array(
        '#title' => t('Teaser node links'),
        '#description' => t('Subscription links will be displayed for node teasers.'),
      );
      return $options;
    case 'event classes':
      return array(
        'node' => t('Node'),
      );
    case 'event actions':
      return array(
        'post' => t('Creation'),
        'update' => t('Update'),
        'comment' => t('Comment'),
      );
  }
}