Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To properly finish the work of #1760548: Remove dependency on jQuery and drupal.js for JS settings Drupal.settings
needs to be removed from core scripts and use the new global drupalSettings
.
- Add a new variable to the closure:
(function ($, Drupal, drupalSettings) { })(jQuery, Drupal, drupalSettings);
- replace
Drupal.settings
withdrupalSettings
This can be taken care of after feature freeze, please direct your attention to feature requests until then :)
Comment | File | Size | Author |
---|---|---|---|
#35 | core-js-drupalSettings-1793648-35.patch | 28.28 KB | nod_ |
#32 | core-js-drupalSettings-1793648-32.patch | 28.26 KB | rteijeiro |
#29 | core-js-drupalSettings-1793648-29.patch | 28.26 KB | nod_ |
#25 | core-js-drupalSettings-1793648-25.patch | 16.16 KB | rteijeiro |
#22 | core-js-drupalSettings-1793648-22.patch | 17.33 KB | nod_ |
Comments
Comment #0.0
nod_note about feature freeze
Comment #1
catchComment #2
nod_Since I'd like that after feature freeze taking it out of the thresholds. I'll put it back when the time comes.
Comment #3
webchickWe're post-feature freeze now, so this can happen. However, since nothing is broken without this being done, don't see why it's critical. Seems like a nice to have?
Comment #4
droplet CreditAttribution: droplet commentedbig & small changes. This kind of changes aren't really need to run crazy manual tests. Errors should be obviously show on browsers console if it had.
Comment #6
droplet CreditAttribution: droplet commented#4: drupalSettings.patch queued for re-testing.
Comment #7
nod_not a nice to have, it's to get rid of the
settings
paramter inattachBehaviors
. Never seen any code using the parameter to change the settings behaviors are initialised with. it's time to get rid of it since it's available in a better place.Comment #8
nod_wow sorry, way outdated page I commented on.
I guess the attachbehavior thing should be a follow-up of the follow-up since there is no serious testing needed for the current change as droplet said.
Comment #9
nod_Comment #10
kmox83 CreditAttribution: kmox83 commentedComment #11
skilip CreditAttribution: skilip commentedAny reason why drupalSettingss is used instead of drupalSettings?
Comment #12
webchickBecause someone made a typo in find/replace. ;)
And since such typos are never going to be caught with the testbot, marking as "Needs manual testing."
Comment #13
kmox83 CreditAttribution: kmox83 commentedMistake, I am packing the correct.
Comment #14
droplet CreditAttribution: droplet commentedahh. I forgot the PHP files, lol. Thanks
@kmox83, you should not find & replace. #4 is more than it. :)
Comment #15
kmox83 CreditAttribution: kmox83 commentedIt was not the only, in drupal.js it needs to be assigned anyway the Drupal.settings so it can be compatible with the modules which still use that.
Comment #16
skilip CreditAttribution: skilip commentedOk, I'm completely new to using drupalSettings so I'm sorry in advance for stupid questions.
First things I noticed after a quick review:
Code in drupal.js is wrapped like this:
Code in ajax.js however is wrapped like this:
I know that it won't cause troubles but shouldn't that be consistently written?
Comment #17
skilip CreditAttribution: skilip commentedBasically I should prefer some kind of hierarchical order in the variables passed to (function(..) {})(..);
E.g.:
But that's probably another issue, right?
Comment #18
Wim Leers#17: Yes, that would be another issue. You'd have to talk to nod_ about that and then update the Drupal JS coding standards: http://drupal.org/node/172169.
I agree that would be nice, but it's of course very nitpick: the order is completely irrelevant for the code itself, it's just a very small DX thing.
Comment #19
droplet CreditAttribution: droplet commentedreload #4 + changed Docs Drupal.settings to drupalSettings.
Comment #20
nod_#19: drupalSettings-19.patch queued for re-testing.
Comment #22
nod_reroll
Comment #23
nod_#22: core-js-drupalSettings-1793648-22.patch queued for re-testing.
Comment #25
rteijeiro CreditAttribution: rteijeiro commentedRe-rolled
Comment #26
nod_OK for me.
Now let's wait forever for someone who can RTBC :p
Comment #27
aspilicious CreditAttribution: aspilicious commentedI grepped around and found some comments that still reference Drupal.settings
Comment #28
nod_Oh I only looked in the JS files, but some might be left in the PHP indeed.
Comment #29
nod_That should do it.
Comment #30
rteijeiro CreditAttribution: rteijeiro commentedIt seems RTBC. No "Drupal.settings" statement found.
Comment #31
webchickDarn, sorry, no longer applies.
Comment #32
rteijeiro CreditAttribution: rteijeiro commentedRe-rolled.
Comment #33
nod_all good.
Comment #34
webchickDarn. Still no longer applies. :\
Comment #35
nod_reroll
Comment #36
rteijeiro CreditAttribution: rteijeiro commentedNow applies well. Let's see what says the testbot and RTBC if green ;)
Comment #37
webchickTestbot can't test anything meaningful with JS changes anyway, so going to get this in while it's hot. :)
Committed and pushed to 8.x. Thanks!
Comment #38
webchickOops. And change notice.
Comment #39
nod_We already had one, updated https://drupal.org/node/1793334.
Comment #40.0
(not verified) CreditAttribution: commentedcode block