Uploaded on

Slides for a presentation on drupal module development at the Gainesville Drupal User's Group on September 13th, 2012.

Slides for a presentation on drupal module development at the Gainesville Drupal User's Group on September 13th, 2012.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Drupal Modules Module Building 101
  • 2. What is a module?• Core Modules o Node o Comment o File o Image o etc...• Contrib Modules o Views o Webform o Block Class o Eldorado Superfly o etc...
  • 3. Why more?
  • 4. Reasons• Performance• New Functionality• Glue Modules• Tweak Modules
  • 5. Performance• Good modules are abstract• Abstraction can be slow• Slow is bad• Custom tailored code can be faster• Tailoring for one site is easier than tailoring for all possible sites now and in the future.
  • 6. New Functionality• Because 18,000 just isn’t enough
  • 7. Glue Modules• API Hooks• Tie functionality together• Most sites could use one
  • 8. Tweak Modules• hook_menu_alter()• hook_menu_link_alter()• hook_menu_breadcrumb_alter()• etc...
  • 9. Tools of the trade• http://api.drupal.org• http://api.drupalize.me• http://drupal.org/project/module_builder• http://drupal.org/project/devel (dpm)• http://drupal.org/project/schema• http://php.net• Editor with a step-through debugger (Eclipse, Komodo, VIM)
  • 10. Anatomy of a module• Placement - sites/all/modules/custom/mymodule• File names• Required Files• Hooks
  • 11. Required Files• mymodule.info• mymodule.module• mymodule.install• ...others as needed
  • 12. What’s in a name?• module_implements($hook)• module_invoke_all($hook)hook = modulenamee.g.views.module, hook_menu() means views_menu()
  • 13. Hooks to know• hook_menu()• hook_form_alter()• hook_block_*()• hook_node_*()• hook_entity_*()• hook_user_*()
  • 14. Working with forms• drupal_get_form(‘my_form’)• my_form() // returns an array• my_form_validate($form, $form_state)• my_form_submit($form, $form_state)• hook_form_alter()
  • 15. Tips for getting started• Read code - examples.module - core modules• Contribute - core office hours - issue queues - IRC, #drupal, #drupal-contribute