Projet

Général

Profil

Paste
Télécharger (3,25 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / variable / variable_realm / variable_realm.api.php @ 7942932f

1
<?php
2
/**
3
 * @file
4
 * Documents hooks provided by Variable Realm API.
5
 */
6

    
7
/**
8
 * @addtogroup hooks
9
 * @{
10
 */
11

    
12
/**
13
 * Provides information about controller classes and weights needed by the realm system
14
 * and some more meta-information for realm administration.
15
 *
16
 * This information is mainly used to build exportable realms as Features.
17
 *
18
 * @see i18n_variable_variable_realm_info()
19
 *
20
 * @return array
21
 *   Array keyed by realm name which contains the following elements:
22
 *   - 'title', Humam readable name for the realm.
23
 *   - 'controller class', Class name for realm controller, implementing VariableRealmControllerInterface.
24
 *   - 'store class', Class name for realm store, implementing VariableRealmStoreInterface.
25
 *   - 'weight', Default weight for this realm.
26
 *   - 'keys', Associative array with human readable names for keys.
27
 *   - 'keys callback', Callback function to provide the keys.
28
 *   - 'default key', The default key.
29
 *   - 'options', Array of variable names that may be set for this realm. If not set
30
 *     any variable will be allowed for this realm.
31
 *   - 'list callback', Callback function to provide variable list for this realm.
32
 *   - 'select', Boolean flag whether variables for this realm can be selected from a list.
33
 *   - 'select path', Path to variable selection form (optional).
34
 *   - 'variable name', Name for variables that belong to this realm: e.g. 'multilingual' variable/s
35
 *   - 'variable class', CSS class name for annotated variables in system settings forms.
36
 *   - 'form settings', Boolean flag, whether realm variables should be handled automatically
37
 *     in system settings forms.
38
 *   - 'form switcher', Boolean flag, whether a realm switcher should be auto-generated
39
 *     for settings forms which contain variables that belong to this realm.
40
 */
41
function hook_variable_realm_info() {
42
  $realm['language'] = array(
43
    'title' => t('Language'),
44
    'controller class' => 'I18nVariableLanguageRealm',
45
    'store class' => 'VariableStoreRealmStore',
46
    'keys' => locale_language_list('name', TRUE),
47
    'default key' => language_default('language'),
48
    'options' => _i18n_variable_variable_realm_list(),
49
    'select' => TRUE,
50
    'select path' => 'admin/config/regional/i18n/variable',
51
    'variable name' => t('multilingual'),
52
    'variable class' => 'i18n-variable',
53
    'form settings' => TRUE,
54
  );
55
  return $realm;
56
}
57

    
58
/**
59
 * Allow other modules to act when enabling a realm.
60
 *
61
 * This hook is invoked right after the realm controller is enabled
62
 * and it may have a valid key already set or it may be FALSE.
63
 *
64
 * @param $realm_name
65
 *   Realm that is switched.
66
 * @param $realm_key
67
 *   New realm key.
68
 */
69
function hook_variable_realm_enable($realm_name, $realm_key) {
70
}
71

    
72
/**
73
 * Allow other modules to act on realm switching.
74
 *
75
 * This hook is invoked right after the realm key is switched but before
76
 * the global variables are rebuilt.
77
 *
78
 * @param $realm_name
79
 *   Realm that is switched.
80
 * @param $realm_key
81
 *   New realm key.
82
 */
83
function hook_variable_realm_switch($realm_name, $realm_key) {
84
}
85

    
86
/**
87
 * Allow other modules to act when rebuilding the configuration.
88
 *
89
 * This hook is invoked before the global variables are rebuilt
90
 * using the active realms.
91
 */
92
function hook_variable_realm_rebuild() {
93
}
94
/**
95
 * @} End of "addtogroup hooks".
96
 */