You are here

function closeblock_submit in Close Block 6

Same name and namespace in other branches
  1. 7 includes/closeblock.form.inc \closeblock_submit()

Form submission handler for block_admin_configure().

See also

block_admin_configure()

closeblock_form_alter()

1 string reference to 'closeblock_submit'
closeblock_block_admin_configure in includes/closeblock.form.inc
Add Closeblock settings to block settings form

File

includes/closeblock.form.inc, line 152

Code

function closeblock_submit($form, &$form_state) {
  $settings = variable_get('closeblock_settings', array());
  $params = array(
    'module' => $form_state['values']['module'],
    'delta' => $form_state['values']['delta'],
  );
  if (empty($params['delta']) && $params['module'] == 'block') {
    $params['delta'] = db_result(db_query('SELECT MAX(bid) FROM {boxes}'));
  }
  $block_id = theme('closeblock_block_id', $params);
  $default_settings = closeblock_default_settings();
  foreach ($default_settings as $key => &$value) {
    if (isset($form_state['values'][$key])) {
      $value = $form_state['values'][$key];
    }
  }
  $settings[$block_id] = $default_settings;
  $settings[$block_id]['module'] = $params['delta'];
  $settings[$block_id]['delta'] = $params['delta'];
  variable_set('closeblock_settings', $settings);
}