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.
The attached patch extends Drupal.settings with the paths of all installed libraries. To get the path of the codemirror library for example, use:
Drupal.settings.libraries['codemirrorPath']
Comment | File | Size | Author |
---|---|---|---|
libraries-js-settings.patch | 540 bytes | davidtrainer | |
Comments
Comment #1
tstoecklerThis should be:
foreach ($libraries as $library => $path) {
to abide by Drupal coding standards
I don't really like that string concatenation. I would like it better, if you could access the paths as
Drupal.settings.libraries[paths][codemirror]
or something like that.Most importantly, though, what is the use-case for this?
In the 7.x-2.x branch we have a lot more information on the libraries than their path, and we definitely don't want store all of that information in JavaScript, so I would really like to know what you are doing with this information.
Comment #2
sunI don't think we want to do this. There's no point to have the path to the PHPMailer library in Drupal.settings.