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.
Do we really need to load contentanalysis.js for every page load for every user? At the very least can we put it in hook_init() for users with the "perform content analysis" permission?
Comment | File | Size | Author |
---|---|---|---|
#2 | 2829530-1-dont-load-javascript.patch | 1.09 KB | mstrelan |
Comments
Comment #2
mstrelan CreditAttribution: mstrelan commentedComment #3
ron_s CreditAttribution: ron_s commentedThe JavaScript should not be loaded based on permission, but rather added to the form where the "Analyze Content" button exists using the
#attached
parameter.Otherwise,
contentanalysis.js
gets loaded on every page, including front-end pages.Also, I consider this a bug, not a feature request. The way it currently works is the wrong way to add JS to a module.