You are here

function ds_emergency_region_to_block_submit in Display Suite 7

Same name and namespace in other branches
  1. 7.2 includes/ds.displays.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 ./ds.layout.inc
Emergency page

File

./ds.layout.inc, line 128
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 ($key === $value) {
        $variable_set = TRUE;
        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.'));
  }
}