backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Settings returned via AJAX are not run through hook_js_alter() #3629

Open klonos opened 5 years ago

klonos commented 5 years ago

This is the same as https://www.drupal.org/project/drupal/issues/2171113

Problem/Motivation

It is possible to change javascript settings via hook_js_alter(), but the settings are returned unaltered from AJAX request.

For example:

function mymodule_js_alter(&$javascript) {
  $javascript['settings']['data'][1]['pathPrefix'] = 'whatever/';
}

Proposed resolution

Use the altered JS settings - if they are available.


PR: https://github.com/backdrop/backdrop/pull/2557

klonos commented 5 years ago

...setting milestone candidate for 1.12.6

herbdool commented 5 years ago

Is this required for something you're working on @klonos? I read the D7 issue and it didn't seem like the patch was 100% acceptable.

klonos commented 5 years ago

IIRC I came across this while doing research around how AJAX works in Drupal, trying to work on #3379.