1 module.inc module_set_weight($module, $weight)

Set the weight of a module in the 'system' table, thereby determining the order in which its hooks will be executed in relation to other modules.

@since 1.17.2 Function added.

Parameters

string $module: The name of the module (without the .module extension).

integer $weight: The weight to set, as an integer.

File

core/includes/module.inc, line 1215
API for loading and interacting with Backdrop modules.

Code

function module_set_weight($module, $weight) {
  db_update('system')
    ->fields(array('weight' => $weight))
    ->condition('type', 'module')
    ->condition('name', $module)
    ->execute();
}