This is Week 7 of the 7-week course Hands-On: Theming. Get started with Drupal 8 theming in 1 hour a week for 7 weeks. Based on our popular Drupal 8 Theming Workshop featured at DrupalCon.
Time to complete: About 1 hour
This week you will learn about preprocess functions and how to utilize them in a Drupal theme. Go through each tutorial and then apply what you've learned in the final hands-on exercise. After you complete the last tutorial listed (Exercise: Preprocess Functions), return to Hands-On: Theming for recommended next steps in the section, "Continue your theming journey".
- Understand the concept of preprocess functions
- Understand what kinds of functions and logic you can put in a .theme file
- Understand the concept of theme hook suggestions
- Understand how you can discover, add, or alter theme hook suggestions
- Be able to complete Exercise: Preprocess Functions in which you will:
- Define a function that implements a preprocess hook
- Define a new variable using PHP and make it available for use within a specific template file
Sign-up for weekly email reminders
Sign-up for the Hands-On Theming email list and get reminders and tips about each week's exercises!