You are here

function authcache_block_submit in Authenticated User Page Caching (Authcache) 7

Same name and namespace in other branches
  1. 6 authcache.module \authcache_block_submit()

Block submit handler.

1 string reference to 'authcache_block_submit'
authcache_form_alter in ./authcache.module
Implements hook_form_alter(),

File

./authcache.module, line 387
Authenticated User Page Caching (and anonymous users, too!)

Code

function authcache_block_submit(&$form, &$form_state) {
  $module = $form_state['values']['module'];
  $delta = $form_state['values']['delta'];

  // Adding block
  if ($module == 'block' && !$delta) {
    $delta = db_result(db_query("SELECT bid FROM {boxes} WHERE info = '%s' ORDER BY bid DESC", $form_state['values']['info']));
  }
  $block_id = "{$module}-{$delta}";
  $authcache_block = variable_get('authcache_block', array());
  if (!$form_state['values']['authcache']) {
    unset($authcache_block[$block_id]);
  }
  else {
    $lifetime = trim($form_state['values']['authcache_lifetime']);
    $authcache_block[$block_id] = is_numeric($lifetime) ? $lifetime : 0;
  }
  variable_set('authcache_block', $authcache_block);
}