Projet

Général

Profil

Paste
Télécharger (1,13 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / i18n / i18n_variable / i18n_variable.class.inc @ 76df55b7

1
<?php
2
/**
3
 * @file
4
 * Variable Realm controller.
5
 */
6

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