<?php
/**
* Implements hook_module_implements_alter().
*/
function YOURMODULENAME_module_implements_alter(&$implementations, $hook) {
// I want that my hook_form_alter will execute last
// Move our hook_form_alter() implementation to the end of the list.
$my_module = 'MYMODULENAME';
if ($hook == 'form_alter') {
$group = $implementations[$my_module];
unset($implementations[$my_module]);
$implementations[$my_module] = $group;
}
// I want that my hook_form_alter will execute first
// Move our hook_entity_bundle_info_alter() implementation to the top of the
// list
if ($hook == 'form_alter') {
$group = $implementations[$my_module];
$implementations = [
$my_module => $group,
] + $implementations;
}
}
// Source: https://drupal.stackexchange.com/questions/186506/how-to-reduce-increase-modules-weight-on-the-module-install-process/197097
// Bonus: https://www.drupal.org/project/modules_weight