Drupal is one of the best open-source web content management platforms available. Built and supported by an active community of developers from around the world, it powers millions of websites and enterprise applications.
For a CMS that has been around for 15 years, the latest release that was in active development for FIVE full years spells dramatic changes. Let’s take a look at the new features in
Drupal 8 that set it so apart from previous versions.
1. Symfony Components in the Core
As explained on the Symfony website - “Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony”.
Adoption of Symfony components and a few other programming concepts is expected to standardize
development in Drupal 8. Object Oriented Programming concept of Symfony will provide multiple benefits such as:
- improved performance
- good multilingual support
- greater efficiency
- less custom code
- easy dependency management
- streamlined folder and file structure
Prior to Drupal 8, namespaces were virtually non-existent. In Drupal 8, modules creating classes should place their code inside a namespace to support autoloading. Also, the class files should be inside the correct folder. Symfony autoloading is based on the open standard
PSR-4.
Example:
Class: Drupal\custom_module\ClassQBUser
Namespace: Drupal\custom_module
File: custom_module/src/ClassQBUser.php
2. Integration of Views into Drupal Core
Hurray! Views module is now in
Drupal 8 core. What that means is, it is available by default. This really simplifies the customization of pages. Instead of editing the core template or creating a fresh view, you (developers or even normal users) can easily modify the view.
Most of the pages now use views, which makes it easy to customize page content by applying filters, adding or removing fields, and setting permissions. You can create a view as a block or as a page.
3. Introduction of REST
REST is one of the most popular ways of making Web Services work. Web Services are implemented in Drupal 8 core using the below-mentioned modules:
- RESTful Web Services - Exposes entities and other resources as RESTful web API.
- Serialization - Based on the Symfony Serializer component and provides a service to serialize data.
- Hypertext Application Language - Serializes entities using Hypertext Application Language.
- HTTP Basic Authentication - Provides basic HTTP authentication for REST resources.
Introduction of REST into Drupal core makes it easier to create REST APIs for your Drupal projects. While creating a view, you can easily create a REST export for the same.
4. Better Content Authoring Capabilities
Inline Editing
Drupal now supports inline editing of page contents using Spark project in core. You can now update page content directly from the frontend and preview the modifications. This feature is called “Quick Edit” and uses AJAX requests to update the contents in real time.
Text Editor
Drupal 8 comes with the popular text editor, CKEditor. Previous versions of Drupal did not have text editors in the core. This newly introduced WYSIWYG editor makes it easy for content authors to format text, insert images, or adjust text alignments without worrying about HTML tags.
Multilingual Support
In previous versions of Drupal, you need to install a number of modules to run a multilingual website. However, all the modules required for multilingual support are part of the Drupal 8 core.
Drupal 8 provides four core modules for multilingual support:
- Configuration Translation - Provides a translation interface for configuration.
- Content Translation - Allows users to translate content entities.
- Interface Translation - Translates the built-in user interface.
- Language - Allows users to configure languages and apply them to content.
You just need to enable these modules to start developing the multilingual website.
5. Responsiveness
Mobile device support is a must for today’s websites. Drupal 8 is developed with a ‘mobile first’ design approach. Each and every element in Drupal 8 core now supports responsive design, including the administrative area of the CMS. This includes tables, toolbars, and such.
All the built-in themes, such as Bartik, Seven, and Stark, are also responsive. So creating a responsive website using Drupal 8 is easier than ever.
6. Twig Template Engine
Twig is the template engine for PHP which is also part of Symfony framework. Drupal 8 introduced Twig template engine as default template engine, replacing the previously present PHPTemplate. Obviously, all template files will now have a
*.html.twig extension.
With Twig, you can easily override the Drupal core template. All you have to do is, find a custom template from base location and make a copy of it in your theme’s folder. You can customize this as you wish using Twig. You can also rename the template file to override specific contents.
For example, if you want to override the template of a custom content type named “blog”, follow these steps:
- Make a copy of node.html.twig file from core/modules/node/templates/node.html.twig and name the file as node--blog.html.twig.
- Place the file inside your current active theme’s templates folder.
- Make the changes in new template file and clear the cache.
You can see the available variable inside the template comments. Drupal will use your custom new template for the “blog” content types display.
7. New Fields
Drupal 8 added five new field types to the core.
- Email - For email address fields
- Reference - To get reference to Image, File, Taxonomy, Content, etc.
- Date - For date picker
- Link - For hyperlinks field
- Telephone number - For telephone numbers
In previous versions, comments for contents were available as a separate setting. Now with Drupal 8, comments are available as a field. You can add comments to anything as easily as you add a normal field.
8. Universally Unique IDentifier (UUID) in Core
Another good news for all Drupal developers is the UUID support in Drupal 8 core. With previous Drupal versions, you have to install and configure UUID module in order to make each object unique by assigning unique IDs. Drupal 8 includes UUID feature as a core module bringing more uniformity to data structures.
Example UUID:
670889d3-38b3-48b4-9515-2122e672465b
With Universal Unique IDs for each and every content, development and migration processes will be more easier.
9. Configuration Import and Export
This is a very useful feature in Drupal 8. You can simply
export and
import any configuration that you created in your Drupal website. Almost like importing and exporting features!
Be it custom content type, field, view, or menu, you can export them for backup or to import later in Drupal 8. An example screenshot of exporting a custom content type is given below.
You can also export the full configuration in a compressed file. This is useful when moving website configurations to a new Drupal installation.
Conclusion
These are the major changes and feature updates that we see in Drupal 8. Most developers have started the development of their contributed modules and themes to make them compatible with Drupal 8. Many are already complete.
It doesn’t matter whether you are a content writer, a webmaster, or a web application developer. With these new features, Drupal has become an even more powerful platform for you to use.