You are here

function subscriptions_types in Subscriptions 5.2

Same name and namespace in other branches
  1. 6 subscriptions.module \subscriptions_types()
  2. 7 subscriptions.module \subscriptions_types()
  3. 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

5 calls to subscriptions_types()
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_perms().
subscriptions_write in ./subscriptions.module
Helper function to do access checking and create a subscription.
_subscriptions_menu in ./subscriptions.module
Given a base url, returns the user menu definition for given user account.

File

./subscriptions.module, line 384
Subscriptions module.

Code

function subscriptions_types($field = NULL, $type = NULL) {
  static $types, $list;
  if (!isset($types)) {
    $types = module_invoke_all('subscriptions', '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;
    }
  }
}