1 views_ui.module views_ui_ajax_get_form($form_id)

Menu callback; handles AJAX form submissions similar to ajax_form_callback(), but can be used for uncached forms.

ajax_form_callback(), the menu callback for the system/ajax path, requires the form to be retrievable from the form cache, because it lacks a trusted $form_id argument with which to call backdrop_retrieve_form(). When AJAX is wanted on a non-cacheable form, #ajax['path'] can be set to a path whose menu router item's 'page callback' is this function, and whose 'page arguments' is the form id, optionally followed by additional build arguments, as expected by backdrop_get_form().

The same caution must be used when defining a hook_menu() entry with this page callback as is used when defining a hook_menu() entry with the 'backdrop_get_form' page callback: a 'page arguments' must be specified with a literal value as the first argument, because $form_id determines which form builder function gets called, so must be safe from user tampering.

See also





core/modules/views_ui/views_ui.module, line 883
Provide structure for the administrative interface to Views.


function views_ui_ajax_get_form($form_id) {
  // @see ajax_get_form()
  $form_state = array(
    'no_redirect' => TRUE,
  $form_state['rebuild_info']['copy']['#build_id'] = TRUE;
  $form_state['rebuild_info']['copy']['#action'] = TRUE;

  // @see backdrop_get_form()
  $args = func_get_args();
  $form_state['build_info']['args'] = $args;
  $form = backdrop_build_form($form_id, $form_state);

  // @see ajax_form_callback()
  if (!empty($form_state['triggering_element'])) {
    $callback = $form_state['triggering_element']['#ajax']['callback'];
  if (!empty($callback) && function_exists($callback)) {
    return $callback($form, $form_state);