You are here

function block_token_form_submit in Block Token 7

Submit callback.

1 string reference to 'block_token_form_submit'
block_token_form_alter in ./block_token.module
Implements hook_form_alter().

File

./block_token.module, line 205
The file contains Block Token module code.

Code

function block_token_form_submit($form, $form_state) {
  $values = $form_state['values'];
  if (isset($values['block_token'])) {

    // Execute the query only when value changes.
    if ($form['settings']['block_token']['#default_value'] != $values['block_token']) {
      db_update('block')
        ->fields(array(
        'block_token' => $values['block_token'],
      ))
        ->condition('module', $values['module'])
        ->condition('delta', $values['delta'])
        ->execute();

      // Flush all filter module cache to use the updated block_token values.
      // @todo flush token caches that prevent new token from displaying.
      cache_clear_all('*', 'cache_filter', TRUE);
    }
  }
}