function homebox_block_edit_form_builder_submit in Homebox 6.2
Same name and namespace in other branches
- 6.3 homebox.module \homebox_block_edit_form_builder_submit()
- 7.3 homebox.module \homebox_block_edit_form_builder_submit()
- 7.2 homebox.module \homebox_block_edit_form_builder_submit()
Save settings for the block and render a replacement with the updated settings.
1 string reference to 'homebox_block_edit_form_builder_submit'
- homebox_block_edit_form_builder in ./
homebox.module - Get an edit form from the implementing module and add the standard buttons and submit handling.
File
- ./
homebox.module, line 665 - Homebox main file, takes care of global functions settings constants, etc.
Code
function homebox_block_edit_form_builder_submit($form, &$form_state) {
$page = $form['#parameters'][2];
$block = $form['#parameters'][3];
$user_blocks = _homebox_get_user_settings($page, TRUE);
// Make sure needed keys exist.
$user_blocks[$block->key] = array_merge(array_flip(module_invoke($block->module, 'homebox_block_keys', $block)), $user_blocks[$block->key]);
// Replace user settings with form values, when keys match.
$user_blocks[$block->key] = array_merge($user_blocks[$block->key], array_intersect_key($form_state['values'], $user_blocks[$block->key]));
_homebox_save_user_settings($page, $user_blocks);
$form_state['redirect'] = FALSE;
// Clear block-specific cache.
init_theme();
$block->edit_form = TRUE;
cache_clear_all(homebox_get_cache_id($page, $block), 'cache_block');
}