The drupal_add_js()
function can be passed a variable in the $options
array so that it includes the file above both theme and module files:
group: A number identifying the group in which to add the JavaScript. Available constants are:
JS_LIBRARY: Any libraries, settings, or jQuery plugins.
JS_DEFAULT: Any module-layer JavaScript.
JS_THEME: Any theme-layer JavaScript.
I don't know if this will break other stuff in omega - but it would be awesome if modules could also use functionality from say omega-mediaqueries.js.
The fix would be simple if it does not break other stuff. Add this to the theme.info file for all the libraries:
libraries[omega_mediaqueries][js][0][options][group] = -100
The -100 is the value of the JS_LIBRARY constant.
Comment | File | Size | Author |
---|---|---|---|
#2 | mediaqueries-js-group-weight-1554256-2.patch | 833 bytes | jghyde |
Comments
Comment #1
Cellar Door CreditAttribution: Cellar Door commentedWhat do you think Himerus? It shouldn't break anything by putting mediaqueries at the top of the stack to open it up to other development options.
Comment #2
jghyde CreditAttribution: jghyde commentedThis solves a problem I am having with the Drupal core "once" JS library. See the details here #1932486: Toolbar.js isn't defined in hook_library().
I have tested naxoc's suggestion and it works (in addition to fixing my problem). I'm including a patch to incorporate this change.
I only applied it for the mediaqueries.js file, since that was causing me fits with the Drupal core once library. Others may want to add others.
Please review it!
Thanks
Joe