function subscriptions_types in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions.module \subscriptions_types()
- 7 subscriptions.module \subscriptions_types()
- 2.0.x subscriptions.module.old.php \subscriptions_types()
Hook subscription_types(). Get info about subscription types.
Return value
Information for a given field and type or information for a given field for all types
6 calls to subscriptions_types()
- subscriptions_menu in ./
subscriptions.module - Implementation of hook_menu().
- subscriptions_page in ./
subscriptions.admin.inc - Display subscribed content data on the user and site subscriptions pages. @ TODO clean up all of these parts
- subscriptions_page_user_overview in ./
subscriptions.admin.inc - Construct the overview page, which displays a summary of subscriptions per type as well as the user settings at user/UID/subscriptions. This form is also used for admin/settings/subscriptions/userdefaults.
- subscriptions_perm in ./
subscriptions.module - Implementation of hook_perm().
- subscriptions_write in ./
subscriptions.module - Helper function to do access checking and create a subscription.
File
- ./
subscriptions.module, line 513 - Subscriptions module.
Code
function subscriptions_types($field = NULL, $type = NULL) {
static $types, $list;
if (!isset($types)) {
$types = module_invoke_all('subscriptions', 'types');
// Allow other modules to alter the data.
drupal_alter('subscriptions_types', $types);
foreach ($types as $stype => $data) {
if (!_subscriptions_validate_hook_result($stype, $data)) {
continue;
}
foreach ($data as $name => $value) {
$list[$name][$stype] = $value;
}
}
}
if ($type) {
return isset($types[$type][$field]) ? $types[$type][$field] : NULL;
}
else {
if ($field) {
return isset($list[$field]) ? $list[$field] : array();
}
else {
return $types;
}
}
}