Page Chapter 2. Writing a Module, Page 13
I've just purchased the Pro Dupal book and installed Drupal Core 6.0. I had trouble getting the sample code on this page — function annotate_menu() — to work in 6.0. The error appeared when I clicked the Enable checkbox for the Annotate module in admin/build/modules.
P.S. Is this typical with changes in major Drupal versions? Should I perhaps work through the book using an earlier version of Drupal?
The error message is:
warning: Missing argument 1 for annotate_menu() in /Applications/MAMP/htdocs/drupal/sites/all/modules/annotate/annotate.module on line 14.
Having a look through the Drupal API site led me to what appears to be a revision to the hook_menu() function. The changes seem to be the source of the error.
[Your suspicion is correct. The error here is that you are using the code from the first edition of Pro Drupal Development (which is compatible with Drupal 5) with Drupal 6. Drupal 5 modules are not compatible with Drupal 6 modules (for a summary of changes in Drupal 6, see here. The second edition of Pro Drupal Development (due in August 2008) will have sample code which is compatible with Drupal 6. -JV]
