You are here

function domain_settings_reset in Domain Access 7.3

Same name and namespace in other branches
  1. 6.2 domain_settings/domain_settings.module \domain_settings_reset()
  2. 7.2 domain_settings/domain_settings.module \domain_settings_reset()

Erase Domain Conf and Batch settings but keep those set by this module.

Parameters

$domain_id: The domain_id to reset.

2 calls to domain_settings_reset()
domain_settings_batch_form_submit in domain_settings/domain_settings.module
Submit handler for batch domain settings.
domain_settings_reset_form_submit in domain_settings/domain_settings.module
Form submit handler to batch reset custom settings.

File

domain_settings/domain_settings.module, line 362
Allows domain-specific use of Drupal system settings forms.

Code

function domain_settings_reset($domain_id) {

  // Get the conf elements and erase them from the record.
  $batch = module_invoke_all('domain_batch');
  $conf = module_invoke_all('domain_conf');
  $list = array_merge(array_keys($batch), array_keys($conf));

  // Get the existing data.
  $settings = domain_conf_data_get($domain_id, TRUE);

  // Erase the settings by key.
  foreach ($list as $item) {
    if (isset($settings[$item])) {
      unset($settings[$item]);
    }
  }

  // Write the update.
  domain_conf_data_set($domain_id, $settings, FALSE);
}