Download & Extend

Behavior weights

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){..}};

  // Let this run before other behaviors (default weight is 0)
  Drupal.behaviors['mymodule_early.weight'] = -7;

  // Alternative way to set the weight. This has a lower priority than the above.
  Drupal.behaviors.mymodule_early.weight = -9;

  // 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!

Downloads

Recommended releases

Version Downloads Date Links
7.x-1.0-alpha1 tar.gz (8.49 KB) | zip (9.47 KB) 2011-Oct-07 Notes
6.x-1.0-alpha1 tar.gz (8.35 KB) | zip (9.32 KB) 2011-Oct-07 Notes

Development releases

Version Downloads Date Links
7.x-1.x-dev tar.gz (8.49 KB) | zip (9.47 KB) 2011-Oct-07 Notes
6.x-1.x-dev tar.gz (8.35 KB) | zip (9.32 KB) 2011-Oct-07 Notes

Project Information


Maintainers for Behavior weights

  • donquixote - 3 commits
    last: 33 weeks ago, first: 33 weeks ago

Issues for Behavior weights

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports