function ds_extras_block_submit in Display Suite 7
Same name and namespace in other branches
- 8.2 modules/ds_extras/ds_extras.module \ds_extras_block_submit()
- 8.3 modules/ds_extras/ds_extras.module \ds_extras_block_submit()
- 7.2 modules/ds_extras/includes/ds_extras.admin.inc \ds_extras_block_submit()
Submit callback: manage block regions.
1 string reference to 'ds_extras_block_submit'
- ds_extras_field_ui_alter in modules/
ds_extras/ ds_extras.admin.inc - Alter Manage display screen.
File
- modules/
ds_extras/ ds_extras.admin.inc, line 623 - Display Suite Extras administrative functions.
Code
function ds_extras_block_submit($form, &$form_state) {
// Create new region.
if (!empty($form_state['values']['additional_settings']['region_to_block']['new_block_region'])) {
// Get the entity_type, bundle and view mode.
$entity_type = $form['#entity_type'];
$bundle = $form['#bundle'];
$view_mode = $form['#view_mode'];
$block = array(
'title' => $form_state['values']['additional_settings']['region_to_block']['new_block_region'],
'info' => "{$entity_type}_{$bundle}_{$view_mode}",
);
$block_key = $form_state['values']['additional_settings']['region_to_block']['new_block_region_key'];
$region_blocks = variable_get('ds_extras_region_blocks', array());
$region_blocks[$block_key] = $block;
variable_set('ds_extras_region_blocks', $region_blocks);
}
// Remove a region.
if (isset($form_state['values']['additional_settings']['region_to_block']['remove_block_region'])) {
$variable_set = FALSE;
$region_blocks = variable_get('ds_extras_region_blocks', array());
$remove = $form_state['values']['additional_settings']['region_to_block']['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) {
variable_set('ds_extras_region_blocks', $region_blocks);
}
}
}