Drupal modules

mixel's picture

Introduction to Drupal module development

During this exercise you will get some basic understanding of developing a drupal module by making use of the drupal hook API's. This exercise and explanation is basic, you can have a look at the drupal manual tutorial for more explanation. Also have a look at the drupal page (in the theory section). You could also use Drush to install Drupal

One of the most important hooks is hook_menu. With it, you can create an URL-paths to call your functions as a page-load. The function, most probably, will make use of the hook_perm to organize the access to the page on the admin level (permissions). In the API manual an example of hook_menu and hook_perm is given to display a custom page at a given URL. A simple Ten Step-by-Step tutorial to Form API will be a good place to start.

Preparations and default operations

You need admin level permission and content to make the exercise useful. Download from pointcarre the WSDB-site (+sql) first and install drupal. Don't forget to change the settings.php file. You can login using 'admin' and password 'test'. In site/all/modules you need to add your new module, next activate the module, o to admin > modules. The .install will create the database for the exercise when activated, there is also a first update script that will go over you current database and populate your new table by the current content in your system. So after activating the module go run 'update.php',you will need to change the settings.php file again, just follow the instructions. Run update 1 to make the system ready for the exercise.

The next exercises are available:

  • Drupal7-drush drush screencast, this is used to install Drupal on command line

    Drupal7-debug debugging screencast, using the dev module and clearing cache

    User interaction: Illustrates hook_menu and hook_comment, uses advanced databases and is reused to illustrate views.