You are here

function notifications_tags_notifications in Notifications 7

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

Implementation of hook_notifications().

File

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

Code

function notifications_tags_notifications($op) {
  switch ($op) {
    case 'subscription types':
      $types['taxonomy_term'] = array(
        'title' => t('Tag'),
        'description' => t('Subscribe to content tagged with a given taxonomy term.'),
        'class' => 'Notifications_Taxonomy_Term_Subscription',
        'field_types' => array(
          'term:tid',
        ),
        'access' => array(
          'subscribe to taxonomy terms',
        ),
      );
      $types['taxonomy_vocabulary'] = array(
        'title' => t('Vocabulary'),
        'description' => t('Subscribe to terms of a given vocabulary.'),
        'class' => 'Notifications_Taxonomy_Vocabulary_Subscription',
        'field_types' => array(
          'vocabulary:vid',
        ),
        'access' => array(
          'subscribe to taxonomy vocabularies',
        ),
      );
      $types['taxonomy_term_multiple'] = array(
        'title' => t('Multiple tags'),
        'description' => t('Subscribe to content tagged with multiple taxonomy terms.'),
        'class' => 'Notifications_Taxonomy_Term_Multiple_Subscription',
        'field_types' => array(
          'term:tid',
        ),
        'access' => array(
          'subscribe to taxonomy terms',
        ),
      );
      $types['content_type_term'] = array(
        'title' => t('Content type and term'),
        'description' => t('Subscribe to content of given type tagged with term.'),
        'class' => 'Notifications_Content_Type_Term_Subscription',
        'field_types' => array(
          'node:type',
          'term:tid',
        ),
        'access' => array(
          'subscribe to taxonomy vocabularies',
        ),
      );
      return $types;
    case 'field types':

      // Information about available fields for subscriptions
      $fields['term:tid'] = array(
        'title' => t('Taxonomy term'),
        'class' => 'Notifications_Taxonomy_Term_Field',
      );
      $fields['vocabulary:vid'] = array(
        'title' => t('Taxonomy vocabulary'),
        'class' => 'Notifications_Taxonomy_Vocabulary_Field',
      );
      return $fields;
    case 'object types':

      // Define object types used by subscriptions and events
      $types['taxonomy_term'] = array(
        'title' => t('Taxonomy term'),
        'class' => 'Notifications_Taxonomy_Term',
      );

      // Define object types used by subscriptions and events
      $types['taxonomy_vocabulary'] = array(
        'title' => t('Taxonomy vocabulary'),
        'class' => 'Notifications_Taxonomy_Vocabulary',
      );
      return $types;
    case 'event types':
      $types['taxonomy_term-create'] = array(
        'object' => 'taxonomy_term',
        'action' => 'create',
        'title' => t('Taxonomy term post'),
        'class' => 'Notifications_Taxonomy_Term_Create_Event',
        'template' => 'notifications_taxonomy_term-created',
        'triggers' => array(
          'taxonomy' => array(
            'taxonomy_term_insert',
            'taxonomy_term_update',
          ),
        ),
        'actions' => array(
          'notifications_tags_term_create_action',
        ),
      );
      return $types;
    case 'message templates':

      // Single node templates
      $types['notifications_taxonomy_term-created'] = array(
        'object' => 'taxonomy_term',
        'title' => t('Taxonomy term created'),
        'class' => 'Notifications_Taxonomy_Term_Create_Template',
      );
      return $types;
  }
}