Mercurial > defr > drupal > popups
changeset 7:85e281a44a62 tip
Refuse to add popups.js to an ajax request that's not already a popup
In some case, if you enable the "Always scan for popups links" options,
Popups Ajax processing will break the original module request.
author | Franck Deroche <franck@defr.org> |
---|---|
date | Fri, 31 Dec 2010 14:13:37 +0100 |
parents | e02de6b2566e |
children | |
files | popups.module |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/popups.module Fri Dec 31 14:07:33 2010 +0100 +++ b/popups.module Fri Dec 31 14:13:37 2010 +0100 @@ -291,6 +291,10 @@ */ function popups_add_popups($rules=NULL) { static $added = FALSE; + static $shouldAdd = NULL; + if (is_null($shouldAdd)) { + $shouldAdd = !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' || $_SESSION['page_override']; + } $settings = array('popups' => array()); if (is_array($rules)) { @@ -307,7 +311,7 @@ drupal_add_js( $settings, 'setting' ); } } - if (!$added) { + if (!$added && $shouldAdd) { // Determing if we are showing the default theme or a custom theme. global $custom_theme; $theme = $custom_theme;