i18n_variable.class.inc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @file
  4. * Variable Realm controller.
  5. */
  6. /**
  7. * Controller for Language realms.
  8. */
  9. class I18nVariableLanguageRealm extends VariableRealmDefaultController {
  10. /**
  11. * Implementation of VariableRealmControllerInterface::getAvailableVariables().
  12. */
  13. public function getAvailableVariables() {
  14. $translatable = array();
  15. $conf = variable_get('i18n_variables', array());
  16. foreach (variable_get_info() as $name => $variable) {
  17. if (!empty($variable['localize']) || in_array($name, $conf)) {
  18. $translatable[] = $name;
  19. }
  20. }
  21. return $translatable;
  22. }
  23. /**
  24. * Implementation of VariableRealmControllerInterface::getDefaultKey().
  25. */
  26. public function getDefaultKey() {
  27. // The default key will match the default language.
  28. return language_default('language');
  29. }
  30. /**
  31. * Implementation of VariableRealmControllerInterface::getRequestKey().
  32. */
  33. public function getRequestKey() {
  34. return i18n_variable_language()->language;
  35. }
  36. /**
  37. * Implementation of VariableRealmControllerInterface::getAllKeys().
  38. */
  39. public function getAllKeys() {
  40. return locale_language_list('name', TRUE);
  41. }
  42. }