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 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.
- Create an install hook.
- 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
- Continue to the next lesson: Movie Project: Create a Drush Command.
Additional resources
- API Documentation: Function hook_update_N (api.drupal.org)
- Video (using hook_update_N): Adding a Table to the Database (Drupalize.Me)