You are here

function ds_emergency_region_to_block_submit in Display Suite 7.2

Same name and namespace in other branches
  1. 7 ds.layout.inc \ds_emergency_region_to_block_submit()

Submit callback of region to block form.

1 string reference to 'ds_emergency_region_to_block_submit'
ds_emergency in includes/ds.displays.inc
Emergency page.

File

includes/ds.displays.inc, line 141
Shows the overview screen with all links to entities.

Code

function ds_emergency_region_to_block_submit($form, &$form_state) {
  if (isset($form_state['values']['remove_block_region'])) {
    $variable_set = FALSE;
    $region_blocks = variable_get('ds_extras_region_blocks', array());
    $remove = $form_state['values']['remove_block_region'];
    foreach ($remove as $key => $value) {
      if ($value !== 0 && $key == $value) {
        $variable_set = TRUE;
        if (module_exists('block')) {
          db_delete('block')
            ->condition('delta', $key)
            ->condition('module', 'ds_extras')
            ->execute();
        }
        unset($region_blocks[$key]);
      }
    }
    if ($variable_set) {
      drupal_set_message(t('Block regions were removed.'));
      variable_set('ds_extras_region_blocks', $region_blocks);
    }
  }
  else {
    drupal_set_message(t('No block regions were removed.'));
  }
}