Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #1
rowly CreditAttribution: rowly commentedPlease post your code.