function block_admin_display_form_submit

Form submission handler for block_admin_display_form().

See also

block_admin_display_form()

File

modules/block/block.admin.inc, line 172

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.