function homebox_admin_display_form_submit in Homebox 6
Same name and namespace in other branches
- 6.3 homebox.admin.inc \homebox_admin_display_form_submit()
- 6.2 homebox.admin.inc \homebox_admin_display_form_submit()
- 7.3 homebox.admin.inc \homebox_admin_display_form_submit()
- 7.2 homebox.admin.inc \homebox_admin_display_form_submit()
Process main home blocks administration form submission.
File
- ./
homebox.admin.inc, line 346 - Home box admin file, takes care admin interface for homebox
Code
function homebox_admin_display_form_submit($form, &$form_state) {
// Page pid
$pid = $form_state['values']['pid'];
// We can safely remove old records
db_query("DELETE FROM {homebox_default} WHERE pid = %d", $pid);
foreach ($form_state['values'] as $key => $block) {
// Check to see if this is a block
// We check $block['region'] == 0, since we don't want to store block that are not enabled
if (is_array($block) && is_numeric($block['bid']) && $block['bid'] != 0 && is_numeric($block['region']) && (int) $block['region'] > 0) {
db_query("INSERT INTO {homebox_default} (bid, pid, weight, region, movable, status, open) VALUES (%d, %d, %d, %d, %d, %d, %d)", $block['bid'], $pid, $block['weight'], $block['region'], $block['movable'], $block['status'], $block['open']);
}
}
// We remove blocks from the homebox_users table that are no longer in the homebox_default table
$result = db_query("DELETE FROM {homebox_users} WHERE pid = %d AND bid NOT IN (SELECT bid FROM {homebox_default})", $pid);
menu_rebuild();
drupal_set_message(t('Home box layout settings have been updated.'));
}