You are here

function i18n_db_rewrite_where in Internationalization 5.2

Same name and namespace in other branches
  1. 5.3 i18n.module \i18n_db_rewrite_where()
  2. 5 i18n.module \i18n_db_rewrite_where()
  3. 6 i18n.module \i18n_db_rewrite_where()

Rewrites queries depending on rewriting mode

1 call to i18n_db_rewrite_where()
i18n_db_rewrite_sql in ./i18n.module
Implementation of hook_db_rewrite_sql()

File

./i18n.module, line 768
Internationalization (i18n) module

Code

function i18n_db_rewrite_where($alias, $mode) {
  switch ($mode) {
    case 'simple':
      return "{$alias}.language ='" . i18n_get_lang() . "' OR {$alias}.language ='' OR {$alias}.language IS NULL";
    case 'mixed':
      return "{$alias}.language ='" . i18n_get_lang() . "' OR {$alias}.language ='" . i18n_default_language() . "' OR {$alias}.language ='' OR {$alias}.language IS NULL";
    case 'strict':
      return "{$alias}.language ='" . i18n_get_lang() . "'";
    case 'node':
    case 'translation':
      return "{$alias}.language ='" . i18n_selection_mode('params') . "' OR {$alias}.language ='' OR {$alias}.language IS NULL";
    case 'default':
      return "{$alias}.language ='" . i18n_default_language() . "' OR {$alias}.language ='' OR {$alias}.language IS NULL";
    case 'custom':
      return str_replace('%alias', $alias, i18n_selection_mode('params'));
  }
}