You are here

function notifications_subscription_types in Notifications 6.2

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

Get info about subscription types

Parameters

$type: String, the subscriptions type OPTIONAL

$field: String, a specific field to retrieve info from OPTIONAL

$check_access: Whether to check user access and filter out disabled types

Information for a given field and type or information for a given field for all types

22 calls to notifications_subscription_types()
NotificationsContentTests::enableSubscriptionTypes in tests/notifications_content.test
NotificationsContentTests::enableUIPages in tests/notifications_content.test
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
notifications_access_user_add in ./notifications.module
Menu access callback, add a given subscription type
notifications_add_subscription_form in ./notifications.pages.inc
Form for creating new subscriptions

... See full list

File

./notifications.module, line 973
Notifications module

Code

function notifications_subscription_types($type = NULL, $field = NULL, $check_access = FALSE) {
  static $types;
  if (!isset($types)) {
    $types = notifications_module_information('subscription types');
    drupal_alter('notifications_subscription_types', $types);
  }
  $result = $types;
  if ($check_access) {
    foreach ($types as $key => $info) {
      if (!empty($info['disabled']) || !empty($info['access']) && !user_access($info['access'])) {
        unset($result[$key]);
      }
    }
  }
  return notifications_info($result, $type, $field);
}