You are here

function i18n_select_query_term_access_alter in Internationalization 7

Implementation of hook_query_term_access_alter().

Rewrite taxonomy term queries so language selection options are enforced.

File

i18n_select/i18n_select.module, line 154
Multilingual content selection module.

Code

function i18n_select_query_term_access_alter(QueryAlterableInterface $query) {
  if (module_exists('i18n_taxonomy') && i18n_select_mode('taxonomy') && i18n_select_check_query($query, 'tid') && ($table_alias = i18n_select_check_table($query, 'taxonomy_term_data', 'tid'))) {
    $query
      ->condition($table_alias . '.language', i18n_select_langcodes());

    // Mark query as altered
    $query
      ->addTag('i18n_select');
  }
}