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


Behavior weights项目的Drush安装命令:复制到剪贴板

注:个别模块仍需开启相关子模块。

项目分类:

周安装量: 
2804
维护状态: 
正在寻找项目共同维护者
开发状态: 
积极开发中

推荐版本下载:

版本下载地址发布日期发布说明翻译下载
7.x-1.0tar.gz (8.5 KB) | zip (9.46 KB)2012年7月26日发布说明简 | 繁 | 更多

开发版本下载:

版本下载地址发布日期发布说明翻译下载
7.x-1.x-devtar.gz (8.5 KB) | zip (9.47 KB)2013年9月30日发布说明简 | 繁 | 更多