function notifications_subscription_types in Notifications 5
Same name and namespace in other branches
- 6.4 notifications.module \notifications_subscription_types()
- 6 notifications.module \notifications_subscription_types()
- 6.2 notifications.module \notifications_subscription_types()
- 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
$default: Default value when querying a specific field
Return value
Information for a given field and type or information for a given field for all types
8 calls to notifications_subscription_types()
- notifications_admin_subscriptions_form in ./
notifications.admin.inc - Subscription types administration
- Notifications_Content_Tests::testNotificationsContent in tests/
notifications_content.test - Play with creating, retrieving, deleting a pair subscriptions
- notifications_notifications in ./
notifications.module - Implementation of notifications_hook()
- notifications_page_subscribe in ./
notifications.admin.inc - Menu callback add subscription
- notifications_page_user_overview in ./
notifications.admin.inc - Menu callback. Overview page for user subscriptions.
1 string reference to 'notifications_subscription_types'
- notifications_admin_subscriptions_form in ./
notifications.admin.inc - Subscription types administration
File
- ./
notifications.module, line 653 - Notifications module
Code
function notifications_subscription_types($type = NULL, $field = NULL, $default = NULL) {
static $types;
if (!isset($types)) {
$types = notifications_module_information('subscription types');
// Variable overrides
if ($settings = variable_get('notifications_subscription_types', NULL)) {
foreach ($settings as $key => $value) {
// Check, because there may be settings for types that have been disabled later
if (isset($types[$key]) && is_array($value)) {
$types[$key] = array_merge($types[$key], $value);
}
}
}
notifications_alter('subscription_types', $types);
}
if ($field && $type) {
return isset($types[$type][$field]) ? $types[$type][$field] : NULL;
}
elseif ($field) {
$return = array();
foreach ($types as $id => $info) {
$return[$id] = isset($info[$field]) ? $info[$field] : $default;
}
return $return;
}
elseif ($type) {
return isset($types[$type]) ? $types[$type] : array();
}
else {
return $types;
}
}