function block_admin_display_form_submit in Drupal 7
Same name and namespace in other branches
- 6 modules/block/block.admin.inc \block_admin_display_form_submit()
Form submission handler for block_admin_display_form().
See also
File
- modules/
block/ block.admin.inc, line 172 - Admin page callbacks for the block module.
Code
function block_admin_display_form_submit($form, &$form_state) {
$transaction = db_transaction();
try {
foreach ($form_state['values']['blocks'] as $block) {
$block['status'] = (int) ($block['region'] != BLOCK_REGION_NONE);
$block['region'] = $block['status'] ? $block['region'] : '';
db_update('block')
->fields(array(
'status' => $block['status'],
'weight' => $block['weight'],
'region' => $block['region'],
))
->condition('module', $block['module'])
->condition('delta', $block['delta'])
->condition('theme', $block['theme'])
->execute();
}
} catch (Exception $e) {
$transaction
->rollback();
watchdog_exception('block', $e);
throw $e;
}
drupal_set_message(t('The block settings have been updated.'));
cache_clear_all();
}