Webdrips Drupal 8 Demo hero images shows Twig code used to create Drupal 8 Themes
2019-02-14

Twig in Drupal 8 Provides a Simple Yet Effective Method to Create and Maintain Drupal Themes

What is a Drupal Theme? Think of themes as the Website's skin. Themes dictate the look and feel of Drupal websites. Themes are made up of template files, HTML (page structure), CSS (page design), Javascript (dynamic page elements), media specific to your site, and other assets. Themes typically provide a great starting point for your design, and can often be tweaked to give you the design you envisioned. There are hundreds of free and premium license-based themes that can be purchased for under $50.

If you're thinking about upgrading to Drupal 8, it's important to understand that the new method of designing/maintaining Drupal themes is cleaner, easier, and safer compared to Drupal 7 and earlier. We expect Drupal 8 themes to be almost 100% compatible with Drupal 9, which is an absolute first for the Drupal community. All that will be needed to upgrade is to replace depreciated code. 

What is Twig and why is it Better?

Drupal 8 moved away from pure PHP-based templates to Twig, a simpler and more secure compiled templating language. The motivation for Twig was the same as moving Drupal to the Symfony platform: adoption of a modern, powerful, OOP-based engine. It removes the requirement that themers understand PHP, and instead provides them with a simple framework to provide the desired layouts. Stated another way, it provides further decoupling of the back and front ends.  

Why is Twig more secure than pure PHP? The simple answer is, it doesn't require the designer to sanitize output subject to cross-site scripting (XSS). Drupal essentially automatically sanitizes all output for you. There are many other benefits if you'd like to learn more.

More Themes Coming Soon to this Drupal 8 Demo Site

Currently this Drupal 8 demo has two themes: the one you're seeing now, and an admin theme you can see and try for yourself right now by requesting access on the homepage

By the end of April, we expect to be adding several Drupal themes to this Drupal 8 demo site that you can view and try yourself, so stay tuned!

Click Below to Test-drive this Feature

Request Editor Access

Let's Talk About Your Drupal Upgrade

Please provide a fully-qualified URL (including "http://" or "https://")