Use hooks to update the database tables and alter form elements.
Objectives and Prerequisites
You will need the following knowledge and skills. If you need a review, check out the 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.
Create a function which creates a table to store the required information about a user.
Alter the user form to add the necessary fields.
Summary
- 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.
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)