function domain_conf_form_submit in Domain Access 7.2
Same name and namespace in other branches
- 5 domain_conf/domain_conf.module \domain_conf_form_submit()
- 6.2 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
- 7.3 domain_conf/domain_conf.admin.inc \domain_conf_form_submit()
FormsAPI for domain_conf_form().
1 string reference to 'domain_conf_form_submit'
- domain_conf_default in domain_conf/
domain_conf.admin.inc - Special configuration options for the main domain.
File
- domain_conf/
domain_conf.admin.inc, line 160 - Domain manager configuration options.
Code
function domain_conf_form_submit($form, &$form_state) {
$new_settings = array();
// Throw away what we don't need.
$ignore = array(
'form_token',
'form_id',
'form_build_id',
'op',
'submit',
'domain_id',
);
foreach ($form_state['values'] as $key => $value) {
if (in_array($key, $ignore)) {
continue;
}
$new_settings[$key] = $value;
}
// INSERT or UPDATE?
$result = db_query("SELECT domain_id, settings FROM {domain_conf} WHERE domain_id = :domain_id", array(
':domain_id' => $form_state['values']['domain_id'],
))
->fetchObject();
if (!empty($result->settings)) {
$settings = domain_unserialize($result->settings);
$merged_settings = array_merge($settings, $new_settings);
db_update('domain_conf')
->fields(array(
'settings' => serialize($merged_settings),
))
->condition('domain_id', $result->domain_id)
->execute();
}
else {
db_insert('domain_conf')
->fields(array(
'domain_id' => $form_state['values']['domain_id'],
'settings' => serialize($new_settings),
))
->execute();
}
drupal_set_message(t('Domain options saved successfully.'));
// Clear the cache.
cache_clear_all();
}