Form Alterations

765 views
726 views

Published on

Shows how to use hook_form_alter. This goes with a DrupalCamp Colorado 09 session.

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
765
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Form Alterations

  1. 1. Form Alterations - Getting What You Want in Drupal Without Hacking Presented by Mark W. Jarrell Drupal/Twitter username: attheshow June 28, 2009 Http://fleetthought.com Sunday, June 28, 2009
  2. 2. What are we talking about? ✤ This is a “how to” session ✤ Modify form elements in Drupal created by either core modules or contributed modules you’ve installed Sunday, June 28, 2009
  3. 3. Why do we need to alter forms? ✤ Custom functionality for our sites ✤ Gives us more control over how things appear in our forms ✤ Can be used to increase efficiency for users entering things into Drupal’s forms ✤ Example: Prepopulating the domain part of the email address for our admin who’s adding new users. Sunday, June 28, 2009
  4. 4. Why not just hack it? ✤ Maintaining something that’s hacked is difficult. ✤ When you upgrade, you may lose your changes. ✤ Other community members can help you because your system conforms to Drupal standards. Sunday, June 28, 2009
  5. 5. What do we need to make it happen? ✤ Devel module http://drupal.org/project/devel ✤ Gives us a great function for inspecting forms (dsm()) ✤ Build a custom module ✤ We’ll call ours “dcc09” Sunday, June 28, 2009
  6. 6. Demo Sunday, June 28, 2009
  7. 7. Further Reading Links ✤ “Modifying Forms in Drupal 5 and 6” http://www.lullabot.com/articles/modifying-forms-5-and-6 ✤ hook_form_alter() function http://api.drupal.org/api/function/hook_form_alter/6 ✤ The D6 Form API (a.k.a. FAPI) quickstart http://api.drupal.org/api/file/developer/topics/forms_api.html/6 ✤ Form API reference http://api.drupal.org/api/file/developer/topics/ forms_api_reference.html/6 Photo On Intro Slide: Http://is.gd/17yFt Sunday, June 28, 2009

×