You are here

function notifications_feed_messaging in Notifications 5

Same name and namespace in other branches
  1. 6 notifications_feed/notifications_feed.module \notifications_feed_messaging()

Implementation of hook_messaging()

File

notifications_feed/notifications_feed.module, line 139
Subscriptions to FeedAPI feeds

Code

function notifications_feed_messaging($op, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL, $arg4 = NULL) {
  switch ($op) {
    case 'message groups':

      // Generic notifications event
      $info['notifications-event-feed'] = array(
        'module' => 'notifications_content',
        'name' => t('Notifications for feed events'),
      );
      return $info;
    case 'message keys':
      $type = $arg1;
      switch ($type) {
        case 'notifications-event-feed':

          // Some parts will be re-used from 'notifications-event' group
          // So we specify only subject and main message
          return array(
            'subject' => t('Subject'),
            'main' => t('Content'),
          );
          break;
      }
      break;
    case 'messages':
      $type = $arg1;

      // Event notifications
      switch ($type) {
        case 'notifications-event-feed':
          return array(
            'subject' => t('Feed updated: [title]'),
            'main' => array(
              t('Some feed items have been updated:'),
              '[feed-items-refresh]',
              t('Read more [feed-url]'),
            ),
          );
      }
      break;
    case 'tokens':
      if ($arg1 == 'notifications-event-feed') {
        return array(
          'feed',
        );
      }
      break;
  }
}