You are here

function bat_type_access_filter in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_unit/bat_unit.module \bat_type_access_filter()

Filters types based on permissions for multiple values.

File

modules/bat_unit/bat_unit.module, line 1312

Code

function bat_type_access_filter($op, $types = array(), $account = NULL) {
  $filtered_types = array();

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $GLOBALS['user'];
  }
  foreach ($types as $key => $type) {
    if (bat_type_access($op, $type, $account)) {
      $filtered_types[$key] = $type;
    }
  }
  return $filtered_types;
}