Last active
April 22, 2017 21:59
-
-
Save JeffTomlinson/d536e50efa8ef61bf4e226ffbadb4c6b to your computer and use it in GitHub Desktop.
Drupal: Set module implementation weight after that of another module
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 my_module_module_implements_alter(&$implementations, $hook) { | |
if ($hook === 'form_alter') { | |
// Implement after simplesamlphp_auth. | |
if (isset($implementations['simplesamlphp_auth'])) { | |
$my_module = ['my_module' => $implementations['my_module']]; | |
unset($implementations['nyun_core']); | |
$offset = array_search('simplesamlphp_auth', array_keys($implementations)) + 1; | |
$implementations = array_slice($implementations, 0, $offset, TRUE) + | |
$my_module + | |
array_slice($implementations, $offset, NULL, TRUE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment