You are here

function domain_conf_variable_delete in Domain Access 7.2

Same name and namespace in other branches
  1. 6.2 domain_conf/domain_conf.module \domain_conf_variable_delete()

Delete a setting from {domain_conf}.

Parameters

$domain_id: The unique domain ID that is being edited.

$variable: The name of the variable you wish to delete.

1 call to domain_conf_variable_delete()
domain_settings_form_submit in domain_settings/domain_settings.module
Submit handler for domain-specific settings.

File

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

Code

function domain_conf_variable_delete($domain_id, $variable) {

  // Get the current settings for this domain, if any.
  $settings = domain_unserialize(db_query("SELECT settings FROM {domain_conf} WHERE domain_id = :domain_id", array(
    ':domain_id' => $domain_id,
  ))
    ->fetchField());

  // Settings found, remove them.
  if (!empty($settings)) {
    unset($settings[$variable]);
    db_update('domain_conf')
      ->condition('domain_id', $domain_id)
      ->fields(array(
      'settings' => serialize($settings),
    ))
      ->execute();
  }
}