diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-08-08 03:05:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-08-08 03:05:26 +0000 |
commit | be614da01feed2201ba13e1e3341daf38c4553be (patch) | |
tree | ad4308698deb00c1fd25d10c5a347428ab183486 /modules/overlay | |
parent | 66d31c52ba73e2216202ab2ee45e8f29d33164ea (diff) | |
download | brdo-be614da01feed2201ba13e1e3341daf38c4553be.tar.gz brdo-be614da01feed2201ba13e1e3341daf38c4553be.tar.bz2 |
- Patch #843272 by David_Rothstein: overlay does a bunch of unnecessary form redirect handling in JavaScript.
Diffstat (limited to 'modules/overlay')
-rw-r--r-- | modules/overlay/overlay.module | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module index edf584adf..0caf8136d 100644 --- a/modules/overlay/overlay.module +++ b/modules/overlay/overlay.module @@ -166,15 +166,6 @@ function overlay_exit() { } /** - * Implements hook_element_info_alter(). - */ -function overlay_element_info_alter(&$types) { - foreach (array('submit', 'button', 'image_button', 'form') as $type) { - $types[$type]['#after_build'][] = 'overlay_form_after_build'; - } -} - -/** * Implements hook_library(). */ function overlay_library() { @@ -370,69 +361,6 @@ function overlay_preprocess_page(&$variables) { } /** - * Form after_build callback. - * - * After all hook_form_alter() implementations have been processed, we look at - * the list of submit handlers and add our own at the end. The added handler - * determines whether or not the user is redirected done at the end of form - * processing, so that it's possible to close the overlay after submitting - * a form. - * - * @see form_execute_handlers() - * @see form_builder() - * @see overlay_form_submit() - * - * @ingroup forms - */ -function overlay_form_after_build($form, &$form_state) { - if (overlay_get_mode() == 'child') { - // If this element has submit handlers, then append our own. - if (isset($form['#submit'])) { - $form['#submit'][] = 'overlay_form_submit'; - } - } - return $form; -} - -/** - * Generic form submit handler. - * - * When we are requested to close an overlay, we don't want Form API to - * perform any redirection once the submitted form has been processed. Instead, - * we set $form_state['redirect'] to FALSE so that Form API will simply - * re-render the current page, and pass the redirect information on to the - * overlay JavaScript so that the redirection can be performed there. - * - * @see overlay_get_mode() - * @ingroup forms - */ -function overlay_form_submit($form, &$form_state) { - if (isset($form_state['redirect'])) { - // A destination set in the URL trumps $form_state['redirect']. - if (isset($_GET['destination'])) { - $url = $_GET['destination']; - $url_settings = array(); - } - elseif (is_array($form_state['redirect'])) { - $url = $form_state['redirect'][0]; - $url_settings = $form_state['redirect'][1]; - } - else { - $url = $form_state['redirect']; - $url_settings = array(); - } - // Close the overlay if we are redirecting to a non-admin page or if the - // overlay module has just been disabled. - if (!path_is_admin($url) || !module_exists('overlay')) { - overlay_close_dialog($url, $url_settings); - // Tell FAPI to stay on the same page after all submit callbacks have - // been processed. - $form_state['redirect'] = FALSE; - } - } -} - -/** * Callback to request that the overlay display an empty page. * * This is used to prevent a page request which closes the overlay (for @@ -478,8 +406,6 @@ function overlay_page_delivery_callback_alter(&$callback) { * * This function is used to print out a bare minimum empty page which still has * the scripts and styles necessary in order to trigger the overlay to close. - * - * @see overlay_form_submit() */ function overlay_deliver_empty_page() { $empty_page = '<html><head><title></title>' . drupal_get_css() . drupal_get_js() . '</head><body class="overlay"></body></html>'; |