You are here

function _notifications_subscription_types in Notifications 6.3

Same name and namespace in other branches
  1. 6 notifications.module \_notifications_subscription_types()
  2. 6.2 notifications.module \_notifications_subscription_types()

Build list of subscription types

Note: some custom types may have user defined strings, that's why the check_plain() everywhere

2 calls to _notifications_subscription_types()
notifications_ui_settings_form in notifications_ui/notifications_ui.pages.inc
Site-wide settings form.
_notifications_content_type_options in notifications_content/notifications_content.module
List subscription options for content types

File

./notifications.module, line 1527
Notifications module

Code

function _notifications_subscription_types($format = 'short', $filter = NULL) {
  $options = array();
  foreach (notifications_subscription_types() as $type => $info) {
    if (!$filter || count(array_intersect_assoc($filter, $info)) == count($filter)) {
      switch ($format) {
        case 'short':
          $options[$type] = check_plain($info['title']);
          break;
        case 'long':
          $options[$type] = '<strong>' . check_plain($info['title']) . '</strong>.';
          if (!empty($info['description'])) {
            $options[$type] .= ' ' . check_plain($info['description']);
          }
          break;
      }
    }
  }
  return $options;
}