Module Development

Movie Project: Create a Form 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.

Create a new module for movie imports, which will display a form when the user navigates to a page.

Goal

Create a custom form inside a custom module.

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. How to create a module.
  2. Use a menu hook to define a start point for the user journey.
  3. Create a form containing a text field and a submit button.

Tasks

Create a new module for movie imports.

Create a menu hook to register the required URL import-movie.

Create a form that displays text about movie imports, a field for a movie title, and a submit button.

Recap

  • Break down a scenario into small pieces of functionality to identify components for re-use.
  • Use hook_menu and the form API to create the necessary form.

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