Skip to content

Commit

Permalink
Integrate with drupal/form_mode_control
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall committed Nov 4, 2024
1 parent c972770 commit 5a41c74
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion js/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,19 @@
fd.append('ajax_page_state[theme_token]', drupalSettings.ajaxPageState.theme_token);
fd.append('ajax_page_state[libraries]', drupalSettings.ajaxPageState.libraries);
// Calculate the post url to use.
var posturl = '?element_parents=' + settings.element_parents + '&ajax_form=1&_wrapper_format=drupal_ajax';
var posturl = '?element_parents=' + settings.element_parents + '&ajax_form=1&_wrapper_format=drupal_ajax&';

// integrate with drupal/form_mode_control
// checking for ?display=foo and appending
// to AJAX request if so
var queryString = window.location.search.substring(1);
var queryParams = queryString.split('&');
for (var i = 0; i < queryParams.length; i++) {
var pair = queryParams[i].split('=');
if (decodeURIComponent(pair[0]) === "display") {
posturl += "display=" + decodeURIComponent(pair[1]);
}
}

// Generate and send an ajax request with the uploaded file details.
$.ajax({
Expand Down

0 comments on commit 5a41c74

Please sign in to comment.