You are here

function notifications_tags_notifications in Notifications 6.4

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

Implementation of hook_notifications().

File

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

Code

function notifications_tags_notifications($op) {
  switch ($op) {
    case 'subscription types':
      $types['taxonomy'] = array(
        'event_type' => 'node',
        'title' => t('Tags'),
        'description' => t('Subscribe to content tagged with a given taxonomy term.'),
        'access' => 'subscribe to taxonomy terms',
        'fields' => array(
          'tid',
        ),
        'page callback' => 'notifications_tags_user_page',
        'user page' => 'user/%user/notifications/taxonomy',
      );
      return $types;
    case 'subscription fields':

      // Information about available fields for subscriptions
      $fields['tid'] = array(
        'name' => t('Taxonomy term'),
        'field' => 'tid',
        'type' => 'int',
        'object_type' => 'term',
      );
      return $fields;
    case 'object types':

      // Define object types used by subscriptions and events
      $types['term'] = array(
        'name' => t('Taxonomy term'),
        'key' => 'tid',
        'load callback' => 'taxonomy_get_term',
        'autocomplete path' => 'notifications_tags/autocomplete/single',
        'format callback' => 'notifications_tags_term_name',
        'value callback' => 'notifications_tags_term_tid',
        'access' => 'access content',
      );
      return $types;
  }
}