function homebox_configure_form_submit in Homebox 6.2
Same name and namespace in other branches
- 6.3 homebox.admin.inc \homebox_configure_form_submit()
- 6 homebox.admin.inc \homebox_configure_form_submit()
- 7.3 homebox.admin.inc \homebox_configure_form_submit()
- 7.2 homebox.admin.inc \homebox_configure_form_submit()
Forms for administration settings
_state
Parameters
$form:
File
- ./
homebox.admin.inc, line 823 - Homebox admin file, takes care admin interface for homebox
Code
function homebox_configure_form_submit($form, &$form_state) {
// Fetch page
$page = homebox_get_page($form_state['values']['name']);
// Adjust settings
$page->settings['regions'] = (int) $form_state['values']['columns'];
$page->settings['cache'] = (int) $form_state['values']['cache'];
$page->settings['color'] = (int) $form_state['values']['colors_enabled'];
// Adjust colors
for ($i = 0; $i < HOMEBOX_NUMBER_OF_COLOURS; $i++) {
$page->settings['colors'][$i] = $form_state['values']['block_color_' . $i];
}
// Adjust widths
$page->settings['widths'] = array();
if ($form_state['values']['width_1']) {
for ($i = 1; $i <= $page->settings['regions']; $i++) {
$page->settings['widths'][$i] = (int) $form_state['values']['width_' . $i];
}
}
// If blocks are available and set on regions that were removed, move them!
foreach ($page->settings['blocks'] as $key => $block) {
// Check block region
if ($block['region'] > $page->settings['regions']) {
$page->settings['blocks'][$key]['region'] = 1;
}
}
// Save settings
homebox_save_page($page);
// Clear out the menu
menu_rebuild();
drupal_set_message(t('The setting have been saved.'));
$form_state['redirect'] = 'admin/build/homebox';
}