function commons_groups_views_pre_view in Drupal Commons 7.3
Implements hook_views_pre_view(). By default, all views should have a group_type filter that looks at only nodes. This function allows those views to also show group content on the front page regardless of their entity type. See https://drupal.org/node/2037417 for more info.
File
- modules/
commons/ commons_groups/ commons_groups.module, line 275
Code
function commons_groups_views_pre_view(&$view, &$display_id, &$args) {
// We check to see if a group id argument is set in the view, and if no arguments
// are being passed to the view. If so, the group_type filter is irrelevant.
if (isset($view->display_handler->options['arguments']['gid']) && empty($args)) {
if (isset($view->display_handler->options['filters']['group_type'])) {
$filters = $view->display_handler
->get_option('filters');
unset($filters['group_type']);
$view->display_handler
->override_option('filters', $filters);
}
}
}