You are here

function block_refresh_submit in Block Refresh 7

Same name and namespace in other branches
  1. 5 block_refresh.module \block_refresh_submit()
  2. 6 block_refresh.module \block_refresh_submit()
  3. 7.2 block_refresh.module \block_refresh_submit()

Submission handler for for block_refresh_menu(). This handles the submission on the specific block configuration page

1 string reference to 'block_refresh_submit'
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 DRUPAL 7 STATUS: APPEARS TO BE WORKING!

File

./block_refresh.module, line 97

Code

function block_refresh_submit($form, &$form_state) {
  $block_id = drupal_html_id('block-' . $form_state['values']['module'] . '-' . $form_state['values']['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']) {
    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]['timer'] = $form_state['values']['block_refresh_timer'];
    $settings[$block_id]['block'] = array(
      'block' => $form_state['values']['module'],
      'delta' => $form_state['values']['delta'],
    );
  }
  variable_set('block_refresh_settings', $settings);
}