You are here

function asaf_pagecache_form_callback in Asaf (ajax submit for any form) 7

Same name and namespace in other branches
  1. 8 asaf.pages.inc \asaf_pagecache_form_callback()
1 string reference to 'asaf_pagecache_form_callback'
asaf_menu in ./asaf.module

File

./asaf.pages.inc, line 3

Code

function asaf_pagecache_form_callback() {
  require_once DRUPAL_ROOT . '/includes/form.inc';
  list($form, $form_state) = asaf_pagecache_get_form();
  drupal_process_form($form['#form_id'], $form, $form_state);

  // We need to return the part of the form (or some other content) that needs
  // to be re-rendered so the browser can update the page with changed content.
  // Since this is the generic menu callback used by many Ajax elements, it is
  // up to the #ajax['callback'] function of the element (may or may not be a
  // button) that triggered the Ajax request to determine what needs to be
  // rendered.
  if (!empty($form_state['triggering_element'])) {
    $callback = $form_state['triggering_element']['#ajax']['callback'];
  }
  if (!empty($callback) && function_exists($callback)) {
    return $callback($form, $form_state);
  }
}