Skip to content

Instantly share code, notes, and snippets.

@boyron
Created May 2, 2014 11:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boyron/4102aa67452fafdd1331 to your computer and use it in GitHub Desktop.
Save boyron/4102aa67452fafdd1331 to your computer and use it in GitHub Desktop.
Drupal views: force contextual filter to use logical OR condition
/**
* @file: MY_MODULE.views.inc
*
* Implementation of hook_views_query_alter().
* @param view $view
* @param views_plugin_query_default $query
*/
function MY_MODULE_views_query_alter(&$view, &$query) {
if ($view->name == 'MY_VIEW') {
$query->where[0]['type'] = 'OR';
}
}
/**
* @file: MY_MODULE.module
*
* Implemented hook_views_api().
*/
function MY_MODULE_views_api() {
return array(
'api' => 3,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment