form alterations
DESCRIPTION
Shows how to use hook_form_alter. This goes with a DrupalCamp Colorado 09 session.TRANSCRIPT
June 28, 2009
Form Alterations - Getting What You Want in Drupal Without HackingPresented by Mark W. Jarrell Drupal/Twitter username: attheshow
Http://fleetthought.com
Sunday, June 28, 2009
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
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
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
What do we need to make it happen?
✤ Devel modulehttp://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
Demo
Sunday, June 28, 2009
Further Reading Links
✤ “Modifying Forms in Drupal 5 and 6”http://www.lullabot.com/articles/modifying-forms-5-and-6
✤ hook_form_alter() functionhttp://api.drupal.org/api/function/hook_form_alter/6
✤ The D6 Form API (a.k.a. FAPI) quickstarthttp://api.drupal.org/api/file/developer/topics/forms_api.html/6
✤ Form API referencehttp://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6
Photo On Intro Slide: Http://is.gd/17yFt
Sunday, June 28, 2009