Last active
August 21, 2020 16:14
-
-
Save rpayanm/b110ab94de86ea1fc9e92bf7eb298f04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment