You are here

function flush_page_cache_custom_settings_table_js in Flush page cache 6

AHAH callback for custom settings table.

Code copied from:

1 string reference to 'flush_page_cache_custom_settings_table_js'
flush_page_cache_menu in ./flush_page_cache.module
Implementation of hook_menu().

File

./flush_page_cache.admin.inc, line 128
Administration pages for the 'Flush page cache' module.

Code

function flush_page_cache_custom_settings_table_js() {

  // Build empty form state and get form from cache.
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);

  // Setup form state
  $args = $form['#parameters'];
  $form_id = array_shift($args);
  $form_state['post'] = $form['#post'] = $_POST;
  $form['#programmed'] = $form['#redirect'] = FALSE;

  // Process and rebuild
  drupal_process_form($form_id, $form, $form_state);
  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);

  // Get the HTML fragment we need to return
  $settings_table = $form['flush_page_cache_custom']['settings_table'];
  unset($settings_table['#prefix'], $settings_table['#suffix']);
  $output = theme('status_messages') . drupal_render($settings_table);

  // Final rendering callback.
  drupal_json(array(
    'status' => TRUE,
    'data' => $output,
  ));
}