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.
Having:
drupal_add_js(drupal_get_path('module', 'filefield') .'/filefield.js');
... in hook_init will stick the filefield JavaScript on every page, no matter if it's required or not. Would be nice to only add it when it's needed.
Comment | File | Size | Author |
---|---|---|---|
#3 | 349319.patch | 1.27 KB | RobLoach |
Comments
Comment #1
Flying Drupalist CreditAttribution: Flying Drupalist commentedBut if you use javascript aggregation then it shouldn't matter. Having them separately requires you to load a different aggregated js for different pages, which would nullify any gains from loading separately.
Comment #2
RobLoachOne of my sites, I don't use JavaScript at all. So the page is being rendered with jQuery, FileField and Drupal.settings.basePath, and isn't even using them. Would be nice to only include it when it's required. I'll have a look at this on Monday.
Comment #3
RobLoachThis patch only presents the JavaScript file when the file widget is being used.
Comment #4
RobLoachComment #5
drewish CreditAttribution: drewish commentedthanks committed to HEAD.