Tập tành Debugging drupalSettings trong Drupal 9

Written by admin
Posted on Tue, 05/10/2022 - 10:19
27 views

Share Everywhere

Table of contents

To see what will drupalSettings output you can put console log in drupalSettingsLoader.js  and this will give you info what is present in drupalSettings vars that is drupal pushing to JS

  if (settingsElement !== null) {
    window.drupalSettings = JSON.parse(settingsElement.textContent);
    console.log(window.drupalSettings);
  }

you can also always call console.log (drupalSettings); in browser console and check out what is in.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
14 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Câu nói tâm đắc: “Điều tuyệt với nhất trong cuộc sống là làm được những việc mà người khác tin là không thể!”