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.
We're building a custom field implementation based upon the chosen library, however we're encountering some loading order issues. As it turns out the "chosen library" javascript file is defined to be part of the JS_DEFAULT
group. Is this by design? IMHO it would make sense to define it in the JS_LIBRARY
group so that it is loaded early and any code can be sure the file is included.
Comment | File | Size | Author |
---|---|---|---|
#8 | chosen-define_libary_in_library_group_7.x_2.x-beta5-2457619-8.patch | 401 bytes | hgoto |
#8 | chosen-define_libary_in_library_group_7.x_3.x-2457619-8.patch | 534 bytes | hgoto |
Comments
Comment #1
Erik FrèrejeanComment #2
h3rj4n CreditAttribution: h3rj4n commentedComment #4
Erik FrèrejeanCorrected patch.
Comment #5
Erik FrèrejeanComment #6
maximpodorov CreditAttribution: maximpodorov commentedSee also #1283470: Doesn't work with Views AJAX / Autosubmit.
Comment #7
m4oliveiRe-rolled and slightly updated for 7.x-2.x-dev (also applies to 7.x-2.x-beta4). When you expose JS through hook_library, the default group is JS_LIBRARY, which is what we want. Therefore, I've just removed any defined options, and that should give us what we want and avoid unexpected behaviour. For example as it is, the group is the string
'JS_LIBRARY'
, which has the effect of putting the script in it's own aggregate all the time.Comment #8
hgoto CreditAttribution: hgoto as a volunteer and at Studio Umi commentedI think m4olivei's approach is good.
Seeing the file common.inc in core, the value of `group` should be a number at least.
- JS_LIBRARY: -100
- JS_DEFAULT: 0
- JS_THEME: 100
The current value 'JS_LIBRARY' is a string and should be changed to a constant `JS_LIBRARY` or the surrounding array should become empty as m4olivei proposed.
I updated m4olivei's patch for the latest version. (Drupal 8 uses a different sytem for libraries and there's no same problem for Drupal 8.)
I would appreciate if another person would review this.
Comment #9
hgoto CreditAttribution: hgoto as a volunteer and at Studio Umi commentedComment #11
nagy.balint CreditAttribution: nagy.balint commentedThanks.
Comment #12
hgoto CreditAttribution: hgoto as a volunteer and at Studio Umi commentedThank you!