You are here

function domain_conf_settings_load in Domain Access 7.3

Recursively set default values of form fields based on settings for the domain being configured.

Parameters

$elements: Array of form elements.

$settings: Array of settings for the domain being configured.

Return value

Array of form elements with default values set.

1 call to domain_conf_settings_load()
domain_conf_api in domain_conf/domain_conf.module
Retrieves elements from hook_domain_conf() and formats them as needed.

File

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

Code

function domain_conf_settings_load($elements, $settings) {
  if (!is_array($elements)) {
    return $elements;
  }
  foreach (element_children($elements) as $key) {
    if (isset($elements[$key]) && $elements[$key]) {
      $elements[$key] = domain_conf_settings_load($elements[$key], $settings);
    }
    if (is_array($elements[$key]) && array_key_exists('#default_value', $elements[$key]) && isset($settings[$key])) {
      $elements[$key]['#default_value'] = $settings[$key];
    }
  }
  return $elements;
}