You are here

function site_verify_edit_form_submit in Site verification 7.2

Same name and namespace in other branches
  1. 6 site_verify.admin.inc \site_verify_edit_form_submit()
  2. 7 site_verify.admin.inc \site_verify_edit_form_submit()

Submission callback; send form to the next step or save the verification.

File

./site_verify.admin.inc, line 248

Code

function site_verify_edit_form_submit($form, &$form_state) {
  if ($form_state['storage']['step'] == 1) {

    // Send the form to step 2 (verification details).
    $form_state['storage']['record']['engine'] = site_verify_engine_load($form_state['values']['engine']);
    $form_state['storage']['step']++;
    $form_state['rebuild'] = TRUE;
  }
  else {

    // Save the verification to the database.
    if ($form_state['values']['svid']) {
      drupal_write_record('site_verify', $form_state['values'], array(
        'svid',
      ));
    }
    else {
      drupal_write_record('site_verify', $form_state['values']);
    }
    drupal_set_message(t('Verification saved.'));
    $form_state['storage'] = $form_state['rebuild'] = NULL;
    $form_state['redirect'] = 'admin/config/search/verifications';

    // Clear front page caches and set the menu to be rebuilt.
    cache_clear_all(url('<front>', array(
      'absolute' => TRUE,
    )), 'cache_page');
    cache_clear_all(url(variable_get('site_frontpage', 'node'), array(
      'absolute' => TRUE,
    )), 'cache_page');
    variable_set('menu_rebuild_needed', TRUE);
  }
}