You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
691 B
24 lines
691 B
/** |
|
* @file |
|
* Parse inline JSON and initialize the drupalSettings global object. |
|
*/ |
|
|
|
(function () { |
|
// Use direct child elements to harden against XSS exploits when CSP is on. |
|
const 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); |
|
} |
|
})();
|
|
|