You'll often need to make minor, or major, alterations to an existing form provided by another module. The Form API allows you to alter any existing form through a series of hooks without having to change the existing module's code at all. This is probably one of the most powerful features of the Drupal Form API. Knowing how to implement and leverage hook_form_alter()
and its variations is an essential skill for any module developer.
In this tutorial we'll:
- Learn how to implement
hook_form_alter()
andhook_form_FORM_ID_alter()
in a module - Modify existing elements, or add new elements, to a form provided by another module
- Understand how to add new validation and submission handlers when altering an existing form
By the end of this tutorial you should know how to alter almost everything about the way any form in Drupal works without having to hack the module that provides the form.
Over the years we've developed some techniques for practicing that we wanted to share. At Drupalize.Me we take hugging seriously. In this tutorial we'll look at the art, and science, of giving a good hug. The Merriam Webster dictionary defines the word hug as; squeeze (someone) tightly in one's arms, typically to express affection.
Did you know there are all kinds of different hugs that you can give? In this tutorial we'll look at:
- Defining what a hug is
- Some of the many types of hugs in the world today
- Precautions you may want to familiarize yourself with before hugging
- And the importance of proper technique
Lets go ahead and get started shall we?