You are here

function notifications_event_types in Notifications 6.3

Same name and namespace in other branches
  1. 5 notifications.module \notifications_event_types()
  2. 6.4 notifications.module \notifications_event_types()
  3. 6 notifications.module \notifications_event_types()
  4. 6.2 notifications.module \notifications_event_types()

Get event types

7 calls to notifications_event_types()
nofitications_digest_event_info in notifications_digest/notifications_digest.module
Get digest information for an event.
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_admin_events_form in ./notifications.admin.inc
Event configuration administration
notifications_digest_line in notifications_digest/notifications_digest.module
Digest each line, with some caching for performance

... See full list

File

./notifications.module, line 1272
Notifications module

Code

function notifications_event_types($type = NULL, $action = NULL) {
  $info =& messaging_static(__FUNCTION__);
  if (!$info) {
    $types = notifications_module_information('event types');
    foreach ($types as $type_info) {
      $info[$type_info['type']][$type_info['action']] = $type_info;
    }
    drupal_alter('notifications_event_types', $info);
  }
  if ($action) {
    if (isset($info[$type][$action])) {

      // The event provides a proper action defined
      return $info[$type][$action];
    }
    elseif (isset($info[$type]['default'])) {

      // The event provides a default action, go for it
      return $info[$type]['default'];
    }
    else {

      // We better make the code break, than return an empty array()
      return NULL;
    }
  }
  elseif ($type) {
    return isset($info[$type]) ? $info[$type] : array();
  }
  else {
    return $info;
  }
}