3

I created a config page for my new module. Whenever I enable the module, a link to the config page is added to the Management menu across the top of the screen as well as a configure link next to the module name in the Modules page. How do I configure this page so that it just shows up with the configure link on the modules page and not in the menu. Below is the code from hook_menu:

$items['admin/mymodule/settings'] = array(
  'title' => 'mymodule Module Configuration',
  'description' => 'Settings for my module',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('_mymodule_admin'),
  'access arguments' => array('administer mymodule settings'),
  'type' => MENU_NORMAL_ITEM,   
);

The module has a function called _mymodule_admin that returns a form array. The config page works great. I just want to prevent the link from appearing on the management menu when the module is activated on my production site.

My info file contains the following line

configure = 'admin/timesdb/settings'

And my form callback has includes this line

return system_settings_form($form);

With the relevant form elements assigned above it.

2 Answers 2

2
+50

It is because you have added a MENU_NORMAL_ITEM under the admin menu, so it will automatically put it in the admin toolbar (that is also the default so if you exclude that parameter it will also be a menu normal item).

If you change it to MENU_CALLBACK, that will create the link between that url and your page callback, but it will not create an item in the menu.

See hook_menu() for all the menu item types.

1
  • Thank you. That was it. I'll award the bounty as soon as the site allows me to (about 13 hours)
    – Robbert
    Jul 28, 2013 at 16:13
0

Its a piece of code put it in the .info file Like :

configure = admin/structure/block

Take a look at BLOCK module or other contributed modules and see the HOOK_MENU in the .module file.

1
  • Thanks for the replay, but I already have that there.
    – Robbert
    Jul 28, 2013 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.