You are here

function _languagefield_getLanguageConfigurationValues in Custom Language field 7

Parameters

$code:

Return value

string

1 call to _languagefield_getLanguageConfigurationValues()
_languagefield_widget_value in ./languagefield.module
Callback function for widget.

File

./languagefield.module, line 637
Provides a list of languages from ISO 639 standard. All variables of a $language-object can be found here: http://api.drupal.org/api/drupal/developer--globals.php/global/language

Code

function _languagefield_getLanguageConfigurationValues($code) {
  $value = LANGUAGE_NONE;
  global $user;
  global $language;
  switch ($code) {
    case LANGUAGEFIELD_SITE_DEFAULT:
      $default_language = language_default();
      $value = $default_language->language;
      break;
    case LANGUAGEFIELD_CURRENT_INTERFACE:
      $value = $language->language;
      break;
    case LANGUAGEFIELD_AUTHORS_DEFAULT:

      // Language is not set for Anonymous user or if locale is not enabled.
      $value = !empty($user->language) ? $user->language : $language->language;
      break;
    default:
      $value = $code;
  }
  return $value;
}