You are here

function spaces_casetracker_views_pre_query in Spaces 5.2

Implementation of hook_views_pre_query()

File

spaces_casetracker/spaces_casetracker.module, line 243

Code

function spaces_casetracker_views_pre_query(&$view) {

  // Switch the assigned to filter to the userspace
  if ($view->name == 'spaces_user_cases') {
    $space = spaces_get_space();
    if ($space && $space->type == 'user') {
      foreach ($view->filter as $k => $filter) {
        if ($filter['field'] == 'casetracker_case.assign_to') {
          $view->filter[$k]['value'] = array(
            $space->sid,
          );
          $view->is_cacheable = false;
          break;
        }
      }
    }
  }
}