You are here

function notifications_lite_messaging in Notifications 6.2

Same name and namespace in other branches
  1. 5 notifications_lite/notifications_lite.module \notifications_lite_messaging()
  2. 6 notifications_lite/notifications_lite.module \notifications_lite_messaging()

Implementation of hook_messaging()

File

notifications_lite/notifications_lite.module, line 172
Simple notifications API

Code

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

      // Generic notifications lite event (message)
      $info['notifications-event-lite'] = array(
        'module' => 'notifications_lite',
        'name' => t('Simple notifications'),
        'help' => t('The subject and main body will be provided by the event itself'),
        'description' => t('Simple notifications triggered by other modules using the Notifications Lite API module.'),
        'fallback' => 'notifications-event',
      );
      $info['notifications-digest-lite'] = array(
        'module' => 'notifications_lite',
        'name' => t('Group of simple notifications'),
        'description' => t('Simple notifications digested with short format.'),
        'help' => t('Every line of the digest will be a separate message.'),
        'fallback' => 'notifications-digest',
      );
      return $info;
    case 'message keys':
      $type = $arg1;
      switch ($type) {
        case 'notifications-event-lite':

          // The other parts for these messages will be given by the event itself
          return array(
            'header' => t('Header'),
            'footer' => t('Footer'),
          );
          break;
        case 'notifications-digest-lite':
          $parts['title'] = t('Group title');
          $parts['closing'] = t('Group footer');
          return $parts;
      }
      break;
    case 'messages':
      $type = $arg1;

      // Event notifications
      switch ($type) {
        case 'notifications-event-lite':
          return array(
            'header' => t("Greetings, [user]."),
            'footer' => array(
              t('This is an automatic message from [site-name]'),
              t('To manage your subscriptions, browse to [subscriptions-manage]'),
            ),
          );
        case 'notifications-digest-lite':
          return array(
            'title' => t('Generic messages'),
            'closing' => '...',
          );
      }
      break;
  }
}