function module_set_weight
Same name and namespace in other branches
- 11.x core/includes/module.inc \module_set_weight()
- 10 core/includes/module.inc \module_set_weight()
- 9 core/includes/module.inc \module_set_weight()
- 8.9.x core/includes/module.inc \module_set_weight()
Sets weight of a particular module.
The weight of uninstalled modules cannot be changed.
Parameters
string $module: The name of the module (without the .module extension).
int $weight: An integer representing the weight of the module.
Deprecated
in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal::service(ModuleWeight::class)->set() instead.
See also
https://www.drupal.org/node/3595653
File
-
core/
includes/ module.inc, line 25
Code
function module_set_weight($module, $weight) : void {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal::service(ModuleWeight::class)->set() instead. See https://www.drupal.org/node/3595653', E_USER_DEPRECATED);
\Drupal::service(ModuleWeight::class)->set($module, $weight);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.