Last active
December 7, 2017 15:23
-
-
Save phreaknerd/bdd505c0b23f650953fe14c463b56f03 to your computer and use it in GitHub Desktop.
Drupal 8 reorder module-priority in form_alter to get the menu into $form.
This file contains hidden or 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
/** | |
* Implements hook_form_FORM_ID_alter() | |
*/ | |
function mymodule_form_node_page_edit_form_alter(&$form, FormStateInterface $form_state) { | |
kint($form); //Now $form['menu'] is present. | |
} | |
/** | |
* Implements hook_module_implements_alter() | |
*/ | |
function mymodule_module_implements_alter(&$implementations, $hook) { | |
if($hook == 'form_alter' && isset($implementations['mymodule'])) { | |
//Move mymodule to the end otherwise $form['menu'] is missing in mymodule_form_node_page_edit_form_alter() | |
$group = $implementations['alingsas_context']; | |
unset($implementations['alingsas_context']); | |
$implementations['alingsas_context'] = $group; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment