This page is archived
We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.
Use hooks to update the database tables and alter form elements.
Goal
Alter a form with user profile data.
Prerequisites
You will need the following knowledge and skills. If you need a review, check out the Additional resources section at the bottom of this page.
- Analyze wireframes and construct a workflow to achieve the objectives.
- Use hooks to work with the database.
- Alter an existing form.
Wireframe reference
You will need to refer to the wireframe collection PDF.
Tasks
Analyze the User Profile view and edit pages of the wireframes, and write pseudocode to illustrate how you could meet the requirements of both screens.
Recap
- Always have a clear idea of how a problem can be solved before beginning development
- Additional tables can be created through hook_schema.
- Forms can be altered to add additional fields.
Further your understanding
- Continue to the next lesson: Movie Project: Create Autocomplete Fields.
Additional resources
- Documentation: Introduction to Schema API (Drupal.org)
- Video: Adding a Table to the Database (Drupalize.Me)
- API Documentation: hook_form_alter (api.drupal.org)
- API Documentation: Form API Reference (api.drupal.org)
- Video: Altering Forms with hook_form_alter() (Drupalize.Me)