Move into nested docroot
This commit is contained in:
parent
83a0d3a149
commit
c8b70abde9
13405 changed files with 0 additions and 0 deletions
web/core/misc
25
web/core/misc/drupalSettingsLoader.js
Normal file
25
web/core/misc/drupalSettingsLoader.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @file
|
||||
* Parse inline JSON and initialize the drupalSettings global object.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Use direct child elements to harden against XSS exploits when CSP is on.
|
||||
var settingsElement = document.querySelector('head > script[type="application/json"][data-drupal-selector="drupal-settings-json"], body > script[type="application/json"][data-drupal-selector="drupal-settings-json"]');
|
||||
|
||||
/**
|
||||
* Variable generated by Drupal with all the configuration created from PHP.
|
||||
*
|
||||
* @global
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
window.drupalSettings = {};
|
||||
|
||||
if (settingsElement !== null) {
|
||||
window.drupalSettings = JSON.parse(settingsElement.textContent);
|
||||
}
|
||||
})();
|
Reference in a new issue