function panels_ajax_form in Panels 5.2
Handle a form for AJAX in a manner that happens to be basically the opposite of the normal flow; if the form hasn't been processed, just render it and exit; if it has been submitted successfuly, however, then we return whatever the submit function returned and do our next step accordingly.
Parameters
$form_id: The id of the form
$title: The title for the modal dialog, if rendered.
$url: The next URL to go to; may be NULL.
...: Any arguments that go to the form.
5 calls to panels_ajax_form()
- panels_ajax_add_config in includes/
display_edit.inc - Entry point for AJAX: Add pane configuration.
- panels_ajax_cache in includes/
display_edit.inc - Entry point for AJAX modal: configure pane
- panels_ajax_cache_settings in includes/
display_edit.inc - Handle the cache settings form
- panels_ajax_configure in includes/
display_edit.inc - Entry point for AJAX: Edit pane configuration.
- panels_panel_settings_ajax in includes/
display_edit.inc - AJAX incoming to deal with the style settings modal
File
- ./
panels.module, line 207 - panels.module Core API for Panels. Provides display editing and rendering capabilities.
Code
function panels_ajax_form($form_id, $title, $url) {
$args = func_get_args();
// Remove the $title and $url
array_splice($args, 1, 2);
$form = call_user_func_array('drupal_retrieve_form', $args);
$form['#redirect'] = FALSE;
$result = drupal_process_form($form_id, $form);
if (isset($result)) {
return $result;
}
// If the form wasn't submitted successfully, render the form.
$output = theme('status_messages');
$output .= drupal_render_form($form_id, $form);
panels_ajax_render($output, $title, $url);
}