

You will need to have the ability to debug code and troubleshoot site problems, analyze and resolve site performance and security issues arising from site configuration and custom code, along with a general ability to write code using Drupal Coding Standards. The final section of the exam will have you demonstrate your ability to develop custom modules using Drupal APIs and Drupal's Database Abstraction Layer for managing tables and CRUD operations on data. Reordering the list of theme hook suggestions.Altering the list of theme hook suggestions.Adding new theme hook suggestions from a theme using hook_theme_suggestions_HOOK_alter().You might for example use a different page template for authenticated users, or a custom block template for someone's birthday. This powerful feature allows for the definition of custom logic in your application that can tell Drupal to use different templates based on your own unique needs. Themes and modules can alter the list of theme hook suggestions in order to add new ones, remove existing ones, or reorder the list. Anytime the desired value requires additional string manipulation beyond what can be easily accomplished using an existing Twig filter or function.īy the end of this tutorial you should be able to expose new variables to a Twig template file by defining a preprocess function in either a module or a theme.Anytime calculating the value to output in a template requires logic more complex than an if/else statement.Make that variable available to a Twig template file.Įxample use cases for adding variables with preprocess functions include:.

Store the resulting calculation in a variable.Use PHP to perform some complex logic in our theme.Modules use preprocess functions to expose the dynamic data they manage to Twig template files, or to alter data provided by another module based on custom logic. For example: adding a variable to all template files that contains the combined content a couple of specific fields under a meaningful name like. They are commonly used by themes to add new variables based on custom PHP logic and simplify accessing the data contained in complex entity structures. Preprocess functions are specially-named functions that can be used to add new variables to a Twig template file. Get a high level overview of the types of files/code that themes are made of.īy the end of this tutorial you should be able to explain what a Drupal theme is, and the kind of work a Drupal theme developer will be expected to do.Explain the role of a Drupal themer in the process of building a Drupal site.Themes consist of standard web assets like CSS, JavaScript, and images, combined with Drupal-specific templates for generating HTML markup, and YAML files for telling Drupal about the file and features that make up each individual theme. Frequently referred to as themers, or theme developers.
#DRUPAL TUTORIAL FOR DEVELOPERS HOW TO#
Whenever a page is requested Drupal does the work of assembling the content to display into structured data which is then handed off to the presentation layer to determine how to visually represent the data provided.ĭrupal themes are created by front-end developer. You can think of a theme as a layer, kind of like a screen, that exists between your Drupal content and the users of your site.

Themes are the part of Drupal that you, and anyone else visiting your Drupal powered application, see when they view any page in their browser.
