function panels_ajax_form_wrapper in Panels 6.2
Based upon Views' views_ajax_form_wrapper, respecialed to Panels' needs.
7 calls to panels_ajax_form_wrapper()
- panels_ajax_add_pane_config in includes/
display-edit.inc - AJAX entry point for to configure a pane that has just been added.
- panels_ajax_cache_method in includes/
display-edit.inc - Entry point for AJAX modal: configure pane cache method
- panels_ajax_cache_settings in includes/
display-edit.inc - Handle the cache settings form
- panels_ajax_configure_pane in includes/
display-edit.inc - AJAX entry point for to configure a pane that has just been added.
- panels_ajax_context_item_add in includes/
common-context.inc - Ajax entry point to add an context
File
- includes/
ajax.inc, line 37 - Miscellaneous AJAX helper routines
Code
function panels_ajax_form_wrapper($form_id, &$form_state) {
// This won't override settings already in.
$form_state += array(
're_render' => FALSE,
'no_redirect' => !empty($form_state['ajax']),
);
$output = drupal_build_form($form_id, $form_state);
if (!empty($form_state['ajax']) && empty($form_state['executed'])) {
// If the form didn't execute and we're using ajax, build up a
// json command object to render.
$object = new stdClass();
$object->output = '';
$object->type = 'display';
if ($messages = theme('status_messages')) {
$object->output = '<div class="views-messages">' . $messages . '</div>';
}
$object->output .= $output;
$object->title = empty($form_state['title']) ? '' : $form_state['title'];
if (!empty($form_state['help_topic'])) {
$module = !empty($form_state['help_module']) ? $form_state['help_module'] : 'panels';
$object->title = theme('advanced_help_topic', $module, $form_state['help_topic']) . $object->title;
}
$object->url = empty($form_state['url']) ? url($_GET['q'], array(
'absolute' => TRUE,
)) : $form_state['url'];
$object->js = empty($form_state['js settings']) ? NULL : $form_state['js settings'];
$output = $object;
}
// These forms have the title built in, so set the title here:
if (empty($form_state['ajax']) && !empty($form_state['title'])) {
drupal_set_title($form_state['title']);
}
return $output;
}