function domain_theme_batch_submit in Domain Access 7.2
Same name and namespace in other branches
- 7.3 domain_theme/domain_theme.module \domain_theme_batch_submit()
Custom handler for domain_theme_domainbatch().
Parameters
$values: The form values passed by the FormsAPI.
1 string reference to 'domain_theme_batch_submit'
- domain_theme_domainbatch in domain_theme/
domain_theme.module - Implements hook_domainbatch()
File
- domain_theme/
domain_theme.module, line 248 - Domain Theme module for the Domain Access module group.
Code
function domain_theme_batch_submit($values) {
foreach ($values['domain_batch'] as $key => $value) {
if ($key > 0) {
// Clear out the old theme.
db_update('domain_theme')
->fields(array(
'status' => 0,
))
->condition('domain_id', $key)
->execute();
$data = db_query("SELECT theme FROM {domain_theme} WHERE theme = :theme AND domain_id = :domain_id", array(
':theme' => $value,
':domain_id' => $key,
))
->fetchField();
if (!empty($data) && $data == $value) {
db_update('domain_theme')
->fields(array(
'status' => 1,
))
->condition('domain_id', $key)
->condition('theme', $value)
->execute();
}
else {
db_insert('domain_theme')
->fields(array(
'domain_id' => $key,
'theme' => $value,
'status' => 1,
))
->execute();
}
}
else {
variable_set('theme_default', $value);
}
}
}