You are here

README.txt in Variable 7

Drupal module: Variable Realm Union.
====================================

This an API module that allows combining two existing realms into a new one
whose keys are a combination of the other two.

An example of this module in action is the 'Domain+I18n Variables Integration' module
which is part of 'Domain Variable' module.

How to use it.
=============
To define a new domain that is a combination of two or more existing ones:

1. Implement hook_variable_realm_info() to define the realm name and properties.

function domain_i18n_variable_variable_realm_info() {
  $realm['domain_language'] = array(
    'title' => t('Domain+Language'),
    // Display on settings forms but without form switcher.
    'form settings' => TRUE,
    'form switcher' => FALSE,
    'variable name' => t('multilingual domain'),
  );
  return $realm;
}

2. Implement hook_variable_realm_controller() to define the Controller class to
    be used and which other realms it is a combination of. Example:

function domain_i18n_variable_variable_realm_controller() {
  $realm['domain_language'] = array(
    'weight' => 200,
    'class' => 'VariableStoreRealmController',
    'union' => array('domain', 'language'),
  );
  return $realm;
}

File

variable_realm_union/README.txt
View source
  1. Drupal module: Variable Realm Union.
  2. ====================================
  3. This an API module that allows combining two existing realms into a new one
  4. whose keys are a combination of the other two.
  5. An example of this module in action is the 'Domain+I18n Variables Integration' module
  6. which is part of 'Domain Variable' module.
  7. How to use it.
  8. =============
  9. To define a new domain that is a combination of two or more existing ones:
  10. 1. Implement hook_variable_realm_info() to define the realm name and properties.
  11. function domain_i18n_variable_variable_realm_info() {
  12. $realm['domain_language'] = array(
  13. 'title' => t('Domain+Language'),
  14. // Display on settings forms but without form switcher.
  15. 'form settings' => TRUE,
  16. 'form switcher' => FALSE,
  17. 'variable name' => t('multilingual domain'),
  18. );
  19. return $realm;
  20. }
  21. 2. Implement hook_variable_realm_controller() to define the Controller class to
  22. be used and which other realms it is a combination of. Example:
  23. function domain_i18n_variable_variable_realm_controller() {
  24. $realm['domain_language'] = array(
  25. 'weight' => 200,
  26. 'class' => 'VariableStoreRealmController',
  27. 'union' => array('domain', 'language'),
  28. );
  29. return $realm;
  30. }