Module Development

Movie Project: Import Data in a Site Update for Drupal 7

Check your version

This tutorial covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Create an install hook to pre-define a list of films to import.

Goal

Import a list of films when your custom module is enabled.

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. Create an install hook.
  2. Use variables within a module.

Tasks

Create an update hook for the Movie Import module that saves a list of movie names in a variable. The list can be hardcoded, or an API can be used to generate the list when the hook is run.

Recap

  • Install hooks are used to define configuration settings and default data for a module.

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