You are here

function notifications_custom_build_list in Notifications 6.4

Retrieve list of custom subscription types true objects

Parameters

$filter: Optional filter conditions. It only works with integer values

$account: User account to get subscriptions for

2 calls to notifications_custom_build_list()
notifications_custom_form_alter in notifications_custom/notifications_custom.module
Implementation of hook_form_alter().
notifications_custom_user_form in notifications_custom/notifications_custom.module
Build user account custom subscriptions form

File

notifications_custom/notifications_custom.module, line 261
Custom notifications module

Code

function notifications_custom_build_list($filter = array(), $account = NULL) {
  $list = notifications_array_filter(notifications_custom_list(), $filter);

  // Take out disabled types
  $list = array_intersect_key($list, notifications_subscription_type_enabled());

  // Now try to match all the parameters against each object in the list
  foreach ($list as $type => $custom) {
    $subscription = notifications_custom_build_subscription($custom);
    $list[$custom->type] = $account ? $subscription
      ->get_instance(array(
      'uid' => $account->uid,
    ), TRUE) : $subscription;
  }
  return $list;
}