function block_refresh_submit in Block Refresh 7.2
Same name and namespace in other branches
- 5 block_refresh.module \block_refresh_submit()
- 6 block_refresh.module \block_refresh_submit()
- 7 block_refresh.module \block_refresh_submit()
Submission handler for for block_refresh_menu(). This handles the submission on both the block configuration page, and the panels pane config page.
2 string references to 'block_refresh_submit'
- block_refresh_form_alter in ./
block_refresh.module - block_refresh_form_block_admin_configure_alter in ./
block_refresh.module - Implements hook_form_FORM_ID_alter(). Add a 'Block Refresh' settings fieldset to the block admin form
File
- ./
block_refresh.module, line 137
Code
function block_refresh_submit($form, &$form_state) {
if ($form['#form_id'] == 'block_admin_configure') {
$module = $form_state['values']['module'];
$delta = $form_state['values']['delta'];
$panels = $form_state['values']['block_refresh_panels'];
}
else {
// The form has been submitted from a panels pane config dialog.
list($module, $delta) = explode('-', $form_state['subtype_name']);
// As the options have been set in the panels pane, we can
// assume that the user wants the block to work in panels.
$panels = 1;
}
$block_id = drupal_html_id('block-' . $module . '-' . $delta);
$settings = variable_get('block_refresh_settings', array());
// If the auto (enable) checkbox AND the manual checkbox are unchecked, we want to remove the current block from the array
if (!$form['block_refresh']['block_refresh_auto']['#checked'] && !$form['block_refresh']['block_refresh_manual']['#checked'] && !$form['block_refresh']['block_refresh_init']['#checked']) {
unset($settings[$block_id]);
}
else {
$settings[$block_id]['element'] = $block_id;
$settings[$block_id]['auto'] = $form_state['values']['block_refresh_auto'];
$settings[$block_id]['manual'] = $form_state['values']['block_refresh_manual'];
$settings[$block_id]['init'] = $form_state['values']['block_refresh_init'];
$settings[$block_id]['arguments'] = $form_state['values']['block_refresh_arguments'];
$settings[$block_id]['panels'] = $panels;
$settings[$block_id]['timer'] = $form_state['values']['block_refresh_timer'];
$settings[$block_id]['block'] = array(
'block' => $module,
'delta' => $delta,
);
$settings[$block_id]['bypass_page_cache'] = $form_state['values']['block_refresh_bypass_page_cache'];
$settings[$block_id]['bypass_external_cache'] = $form_state['values']['block_refresh_bypass_external_cache'];
}
variable_set('block_refresh_settings', $settings);
}