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.
Check and create taxonomy terms programmatically.
In a custom module, create taxonomy terms and relate them to a node.
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 taxonomy terms programmatically.
- Associate taxonomy terms with a node programmatically.
Write conditional logic to meet the following requirements:
- If a taxonomy term already exists, get the term ID.
- If the taxonomy term does not exist, create it and return the term ID.
Populate the Genre field with the relevant terms from the data object you retrieved from The Movie DB API in the previous lesson.
- Taxonomy terms can be created programmatically.
- Terms are associated with nodes via a term ID.
Further your understanding
- Continue to the next lesson: Movie Project: Import Data in a Site Update.
- API Documentation: Taxonomy functions (api.drupal.org)