You are here

function _modules_weight_module_set_weight in Modules weight 7

Sets the weight of a particular module.

Parameters

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

int $weight: An integer representing the weight of the module.

2 calls to _modules_weight_module_set_weight()
drush_modules_weight_mw_reorder in ./modules_weight.drush.inc
Callback for the mw-reorder command.
modules_weight_admin_config_page_form_submit in ./modules_weight.admin.inc
Form submit handler for the modules_weight_admin_config_page_form form.

File

./modules_weight.helpers.inc, line 80
Helper functions.

Code

function _modules_weight_module_set_weight($module, $weight) {

  // The query.
  $query = "UPDATE {system}\n            SET weight = :weight\n            WHERE type = 'module'\n              AND name = :name";

  // Executing the query.
  db_query($query, array(
    ':weight' => $weight,
    ':name' => $module,
  ));
}