Create an administration form to save information about how the movie importer works by using variables.
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.
- Create administration forms to set variables within Drupal.
- Use variables where appropriate within custom modules.
Tasks
Create a menu hook to load an administration form. The form should be in a new file that has the sole purpose of containing the definition of a configuration form.
Allow the user to set the API URL as a variable, which is then used with the request made to the API.
Create an update hook to set the default variable of the API URL.
Summary
- Forms are often used to manage configuration settings for modules, and are often kept separate from the main functionality of a module.
- Update hooks are used to manage changes in configuration.
Resources
- API Documentation: Form API (api.drupal.org)
- Video: Creating a Configuration Settings Form for Your Module (Drupalize.Me)