Skip to content

Instantly share code, notes, and snippets.

@ThomasHambach
Last active January 4, 2016 00:09
Show Gist options
  • Save ThomasHambach/8539796 to your computer and use it in GitHub Desktop.
Save ThomasHambach/8539796 to your computer and use it in GitHub Desktop.
Drupal 7, search in current language.
<?php
/**
* Implements of hook_query_node_access_alter().
*/
function my_search_module_query_node_access_alter(QueryAlterableInterface $query) {
$db_and = db_and();
$language = i18n_language_interface();
$db_and->condition($node . '.language', $language->language, '=');
$query->condition($db_and);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment