You are here

function domain_conf_api in Domain Access 7.3

Same name and namespace in other branches
  1. 5 domain_conf/domain_conf.module \domain_conf_api()
  2. 6.2 domain_conf/domain_conf.module \domain_conf_api()
  3. 7.2 domain_conf/domain_conf.module \domain_conf_api()

Retrieves elements from hook_domain_conf() and formats them as needed.

Parameters

$all: Should the function return all hook implementations or just those marked with the domain_settings flag. Defaults to FALSE. Used to determine if we are loading configuration options specific to the Domain Access module.

Return value

An array of form elements according to the FormsAPI or an empty array.

1 call to domain_conf_api()
domain_conf_form in domain_conf/domain_conf.admin.inc
Custom form to generate domain-specific site settings.

File

domain_conf/domain_conf.module, line 222
Domain manager configuration options.

Code

function domain_conf_api($all = FALSE, $settings = array()) {
  global $_domain;
  $options = array();
  $extra = module_invoke_all('domain_conf', $_domain);
  if (!empty($extra)) {
    foreach ($extra as $key => $value) {
      foreach (element_children($value) as $element) {
        if (isset($value[$element]['#default_value']) && isset($settings[$element])) {
          $value[$element]['#default_value'] = $settings[$element];
        }
      }
      if (!empty($value['#domain_setting']) || $all == TRUE) {

        // Discard the #domain_setting flag; it is not needed.
        unset($value['#domain_setting']);

        // Set the $options array.
        $options[$key] = domain_conf_settings_load($value, $settings);
      }
    }
  }
  return $options;
}