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.
This module's API allows to set weights for behaviors attached via Drupal.behaviors.
See How can I control the order of Drupal.behaviors? (on stackoverflow).
You will only need this module if you either want to use it in your own code, or if another module depends on it.
API Usage (D6)
(function(){
// Let this run before other behaviors (default weight is 0)
Drupal.behaviors['mymodule_early.weight'] = -10;
// Now define the behavior itself.
Drupal.behaviors.mymodule_early = function(context){
.. // your stuff to happen.
};
})();
API Usage (D7)
(function(){
Drupal.behaviors.mymodule_early = {
attach: function(context){..},
weight: -11
};
})();
or
(function(){
// D7-style weight setting, equivalent with the above.
Drupal.behaviors.mymodule_early.weight = -9;
// D6-style weight setting, still supported in D7.
// This has a lower priority than the D7-style setting. (don't ask why)
Drupal.behaviors['mymodule_early.weight'] = -7;
// The weight will be -7, because the ['..'] syntax has higher priority.
})();
Looking for Co-Maintainer
This is never going to be a big module, but nevertheless it could be helpful to have someone else in the boat, if only as a critical voice!
Project information
- Seeking co-maintainer(s)
Maintainers are looking for help reviewing issues. - 1,886 sites report using this module
- Created by donquixote on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
7.x-1.0
released 26 July 2012
Works with Drupal: 7.x
✓ Recommended by the project’s maintainer.
Development version: 7.x-1.x-dev updated 7 Oct 2011 at 12:03 UTC