What is a theme and how do I get started making one for my site? This tutorial introduces the concept of theming at a very high level and points to additional tutorials about more specific aspects of theme development in order to help people get started.
Rather than starting from scratch, Drupal themes start from an existing HTML framework and make changes as needed by overriding and changing just the necessary templates. Some themes only need to modify a few select bits, while others may choose to override nearly everything. Either way, if it's HTML, you can change it with a theme.
In order for this to work, every component in Drupal that needs to display something in the browser provides a simple, minimal, HTML template for that element. Whether it's the content of a node, the site logo displayed in the header, or even the header region itself, the required HTML is rendered from a template. These templates can be overridden by a theme in order to change the markup they generate.
Themes are used to:
- Change the HTML markup of anything in Drupal
- Add CSS styles to change the layout, color, or typography on one or more pages
Without having to write any code for a theme you can:
- Install, enable, and configure an existing theme through the Drupal interface
- Download and install new themes from Drupal.org
Once you're ready to start creating your own custom theme or modifying an existing theme you'll want to know about:
- The structure and organization of a theme's files
- Describing your theme with an info file
- Using base themes
- Defining regions
- The Twig template language
- Overriding template files
- Using PHP for additional preprocessing of dynamic content
- Our Favorite HTML and CSS Resources -- Do you need to brush up on HTML or CSS? You'll get the most out of our Drupal theming tutorials if you already have a good foundation with these basic web technologies. This list contains some of our favorite resources and references around the Internet related to HTML and CSS.
- YAML -- As a themer, you'll need to know how to create, edit, and understand YAML syntax.
- Theming Drupal 8 (Drupal.org)
- Search for contributed Drupal themes (Drupal.org)
- A Drupal 8 theming guide (github.com/sqndr)
- Explain to someone else what a Drupal theme is.
- Explain the role of a Drupal themer in the process of building a Drupal site.
- What types of files/code does a themer deal with?