You are here

function i18n_selection_mode in Internationalization 5

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

i18n_selection_mode

Allows several modes for query rewriting and to change them programatically off = No language conditions inserted simple = Only current language and no language mixed = Only current and default languages strict = Only current language default = Only default language user = User defined, in the module's settings page params = Gets the stored params reset = Returns to previous custom = add custom where clause, like "%alias.language = 'en'"

12 calls to i18n_selection_mode()
i18n_db_rewrite_sql in ./i18n.module
Implementation of hook_db_rewrite_sql()
i18n_db_rewrite_where in ./i18n.module
Rewrites queries depending on rewriting mode
i18n_init in ./i18n.module
Implementation of hook_init()
i18n_menu in ./i18n.module
Implementation of hook_menu(). Modify rewriting conditions when viewing specific nodes
i18n_nodeapi in ./i18n.module
Implementation of hook_nodeapi().

... See full list

3 string references to 'i18n_selection_mode'
i18n_admin_settings in ./i18n.module
Form builder function.
i18n_init in ./i18n.module
Implementation of hook_init()
i18n_views_pre_query in i18nviews/i18nviews.module
Implementation of hook_views_pre_query().

File

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

Code

function i18n_selection_mode($mode = NULL, $params = NULL) {
  static $current_mode = 'simple';
  static $current_value = '';
  static $store = array();
  if (!$mode) {
    return $current_mode;
  }
  elseif ($mode == 'params') {
    return $current_value;
  }
  elseif ($mode == 'reset') {
    list($current_mode, $current_value) = array_pop($store);

    //drupal_set_message("i18n mode reset mode=$current_mode value=$current_value");
  }
  else {
    array_push($store, array(
      $current_mode,
      $current_value,
    ));
    $current_mode = $mode;
    $current_value = $params;
  }
}