variable_realm.api.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @file
  4. * Documents hooks provided by Variable Realm API.
  5. */
  6. /**
  7. * @addtogroup hooks
  8. * @{
  9. */
  10. /**
  11. * Provides information about controller classes and weights needed by the realm system
  12. * and some more meta-information for realm administration.
  13. *
  14. * This information is mainly used to build exportable realms as Features.
  15. *
  16. * @see i18n_variable_variable_realm_info()
  17. *
  18. * @return array
  19. * Array keyed by realm name which contains the following elements:
  20. * - 'title', Humam readable name for the realm.
  21. * - 'controller class', Class name for realm controller, implementing VariableRealmControllerInterface.
  22. * - 'store class', Class name for realm store, implementing VariableRealmStoreInterface.
  23. * - 'weight', Default weight for this realm.
  24. * - 'keys', Associative array with human readable names for keys.
  25. * - 'keys callback', Callback function to provide the keys.
  26. * - 'default key', The default key.
  27. * - 'options', Array of variable names that may be set for this realm. If not set
  28. * any variable will be allowed for this realm.
  29. * - 'list callback', Callback function to provide variable list for this realm.
  30. * - 'select', Boolean flag whether variables for this realm can be selected from a list.
  31. * - 'select path', Path to variable selection form (optional).
  32. * - 'variable name', Name for variables that belong to this realm: e.g. 'multilingual' variable/s
  33. * - 'variable class', CSS class name for annotated variables in system settings forms.
  34. * - 'form settings', Boolean flag, whether realm variables should be handled automatically
  35. * in system settings forms.
  36. * - 'form switcher', Boolean flag, whether a realm switcher should be auto-generated
  37. * for settings forms which contain variables that belong to this realm.
  38. */
  39. function hook_variable_realm_info() {
  40. $realm['language'] = array(
  41. 'title' => t('Language'),
  42. 'controller class' => 'I18nVariableLanguageRealm',
  43. 'store class' => 'VariableStoreRealmStore',
  44. 'keys' => locale_language_list('name', TRUE),
  45. 'default key' => language_default('language'),
  46. 'options' => _i18n_variable_variable_realm_list(),
  47. 'select' => TRUE,
  48. 'select path' => 'admin/config/regional/i18n/variable',
  49. 'variable name' => t('multilingual'),
  50. 'variable class' => 'i18n-variable',
  51. 'form settings' => TRUE,
  52. );
  53. return $realm;
  54. }
  55. /**
  56. * Allow other modules to act when enabling a realm.
  57. *
  58. * This hook is invoked right after the realm controller is enabled
  59. * and it may have a valid key already set or it may be FALSE.
  60. *
  61. * @param $realm_name
  62. * Realm that is switched.
  63. * @param $realm_key
  64. * New realm key.
  65. */
  66. function hook_variable_realm_enable($realm_name, $realm_key) {
  67. }
  68. /**
  69. * Allow other modules to act on realm switching.
  70. *
  71. * This hook is invoked right after the realm key is switched but before
  72. * the global variables are rebuilt.
  73. *
  74. * @param $realm_name
  75. * Realm that is switched.
  76. * @param $realm_key
  77. * New realm key.
  78. */
  79. function hook_variable_realm_switch($realm_name, $realm_key) {
  80. }
  81. /**
  82. * Allow other modules to act when rebuilding the configuration.
  83. *
  84. * This hook is invoked before the global variables are rebuilt
  85. * using the active realms.
  86. */
  87. function hook_variable_realm_rebuild() {
  88. }
  89. /**
  90. * @} End of "addtogroup hooks".
  91. */