Introduction to Drupal's API and using hooks - Customize the contact page

This session will introduce: hook_form_FORM_ID_alter, the Form API, and hook_mail_alter. It also serves as an introduction to writing custom modules.

Yes! Even total beginners can step right into Drupal "coolness." The process to customize the contact page is actually quite simple.

  • We create our very own custom module to hold some code
  • We use the Form API inside of hook_form_FORM_ID_alter to add fields to the contact page
  • We use hook_mail_alter to include our new fields in the email that is sent

If time allows, we will extend the concept and look at creating a totally custom form that sends an email.

Skill Level:
Beginner
Intermediate
Track:
Development
Slides: