By Makea on
I'd like to include additional form options within the menu fieldset on node create/edit forms using hook_form_alter with my own module. However, my form element additions don't display. The weird part is that everything works if I want to nest on other fieldsets like 'options'.
When I do a print_r of the $form array, every other form element appears except for the menu form elements.
Any ideas?
function avanced_menu_form_alter($form_id, &$form) {
if(isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
$form['menu']['menu_advanced'] = array(
'#title' => t('Advanced menu options'),
'#type' => 'fieldset',
'#collapsible' => true,
'#weight' => 500,
);
}
}
Comments
execute module by alphabetical name
try this:
rename everything to come alphabetically later than then m in menu.module.
So using your example, rename to the following:
zavanced_menu.module
zavanced_menu.info
Or change module weight
You could also change your module's weight using SQL/PhpMyAdmin in the system table. When two modules have the same weight, their hooks are called in alphabetically order, so you can name your module whatever you like, but give it a weight higher than that of the menu.module.
Dave
Yikes!
Thanks for the weight info.
I noticed that the token module has a sql query that manually sets the weight in the systems table using it's .install file:
re: weight
Yeah I was going to suggest that next, but I wasn't sure of the SQL syntax, so I didn't.
:)
Dave