Sunday, February 8th, 2009
A customized Drupal module won’t be very useful if the admin user can’t configure it to their needs. This usually consists of several form fields where variables and inputs can be set. Within the module these fields are created within a function, however unlike other common module functions this one is not a hook and does not need a specific function name (although the names are usually along the lines of testmodule_admin or testmodule_settings). The following is an example of the structure these functions can take.
No HTML has to be coded to create the form, as this is all done by Drupal. The systems_settings_form function is used to add default buttons and set a form prefix. Note that variable_get is used to set the default value. However, these settings mean nothing if they don’t interact with how the main module displays its contents. In most cases this involves grabbing information from the database – this information needs to conform to our configuration settings. In this example, we want to limit the number of nodes retrieved to 5.
To add this page to the sites menu system we must make use of hook_menu. Here we can set the page path, title and permissions.
If you have already installed and enabled your module, it may be worth disabling and enabling it again for the new settings page to work properly. Resource: http://drupal.org/node/206761 Posted in Web development, Drupal, Drupal modules, Drupal customisation, Drupal development, Drupal configuration | Edit | Comments Off








Comments
Hello, I've been searching
Hello, I've been searching online about configuration page. Then i found this blog,
you have such great article detailed the steps in creating a module configuration page. I'm so thankful I found this page. Good Job!
Thanks for this article. It
Thanks for this article. It really helped me a lot .