Module Development

Movie Project: Create Database Tables and Alter Forms for Drupal 7

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.

  1. Analyze wireframes and construct a workflow to achieve the objectives.
  2. Use hooks to work with the database.
  3. 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.

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

Additional resources

Creative Commons License

Drupal Training Resources by Damian Robinson are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at http://www.damianrobinson.co.uk.

Hands-On Exercises: Movie Project