jac*_*cnr 25
这是在Drupal 7中执行此操作的正确方法
/**
* Implements hook_enable()
*/
function YOUR_MODULE_enable() {
db_update('system')
->fields(array('weight' => 1))
->condition('type', 'module')
->condition('name', 'YOUR_MODULE')
->execute();
}
Run Code Online (Sandbox Code Playgroud)
goo*_*orp 20
标准方法是在install hook中的查询中执行此操作.
来自devel模块:
/**
* Implementation of hook_install()
*/
function devel_install() {
drupal_install_schema('devel');
// New module weights in core: put devel as the very last in the chain.
db_query("UPDATE {system} SET weight = 88 WHERE name = 'devel'");
...
}
Run Code Online (Sandbox Code Playgroud)