Need help for modal form redirection should open in new window. I tried with following patch but still now working

diff --git a/includes/ajax.inc b/includes/ajax.inc
index 05416af..956935f 100644
--- a/includes/ajax.inc
+++ b/includes/ajax.inc
@@ -414,12 +414,15 @@ function ctools_ajax_command_restripe($selector) {
  *   A delay before applying the redirection, in milliseconds.
  * @param $options
  *   An array of options to pass to the url() function.
+ * @param $new_window
+ *   A bool to determine if the URL should open in a new window.
  */
-function ctools_ajax_command_redirect($url, $delay = 0, $options = array()) {
+function ctools_ajax_command_redirect($url, $delay = 0, $options = array(), $new_window = FALSE) {
   return array(
     'command' => 'redirect',
     'url' => url($url, $options),
     'delay' => $delay,
+    'new_window' => $new_window,
   );
 }
 
diff --git a/js/ajax-responder.js b/js/ajax-responder.js
index 60ee17a..49a9a52 100644
--- a/js/ajax-responder.js
+++ b/js/ajax-responder.js
@@ -501,9 +501,17 @@
   Drupal.CTools.AJAX.commands.redirect = function(data) {
     if (data.delay > 0) {
       setTimeout(function () {
-        location.href = data.url;
+        if (data.new_window) {
+          window.open(data.url, '_blank');
+        }
+        else {
+          location.href = data.url;
+        }
       }, data.delay);
     }
+    else if (data.new_window) {
+      window.open(data.url, '_blank');
+    }
     else {
       location.href = data.url;
     }

Comments

rowly’s picture

Please post your code.