CMS

Getting Ready for Drupal 9

Drupal 9 is expected to be released on June 3rd,2020. As Drupal developers, we need to understand the requirements for upgrading to Drupal 9 Also, is it really that difficult to upgrade to Drupal 9?  No! On the contrary, it is absolutely easy and requires a very less effort since Drupal 9 is not being built on a new core but within the same core of Drupal 8. Drupal 9 is a cleaner version of Drupal 8. All the new features and functionalities that are required will be added to the last minor versions of Drupal 8 which would probably be Drupal 8.9 as backward-compatible code. That means the new features would be available for D8 users for better usability without superseding the old features. Once all the new features get stable they would be available for Drupal 9 with the older code deprecated.

Why Upgrade to Drupal 9?

  • Support for Drupal 7 and Drupal 8 will be stopped after November 2021 which would lead to security issues for the website and no up-gradation.
  • Drupal 8 was introduced by keeping scalability in mind which can be achieved in a better way with Drupal 9.
  • The Deprecated code is regularly being removed from Drupal 8 and when it reaches Drupal 9 most of the deprecated code will be gone.
  • Simplify and Clean up content for a better user experience.

 

Drupal 9 Focuses on:

  • Reduce Cost and Effort of site owners and Developers like a reusable component library, Composer improvements, Drush in the core, etc.
  • Prioritize the beginner experience like Providing Guided Tours, Easier Terminology, WYSIWYG Page building, Install Profiles for the common use cases, etc.
  • New Drupal Administration theme – Olivero which replaces older themes like Bartik which gives an outdated feel. Olivero has a completely modern look providing the latest features.
  • Driving open web with Accessibility, Secure, Interoperable, Privacy support, Semantic HTML, etc.,
  • Best Structured Data Engine

 

Things to consider to upgrade a site from Drupal 8 to Drupal 9

Drupal 8 developers can explore Drupal 9 features right from the beginning since it is backward compatible and begin to upgrade any core or contributed modules.

  • Install the Upgrade Status Module to check the readiness for Drupal 9.
  • Keep the Drupal core up to date as Drupal 9 will have the same features that the last minor release of Drupal 8 has. Drupal 8.8 has been recently released and includes some of the new features like:

    1. Stable Media Library: allows easy reuse of images, documents, videos, and other assets across the site that has been integrated into content forms and seamlessly fits into CKEditor
    2. New experimental administration theme: The Claro administration theme is a modern theme that is clean, accessible, powerful and is easier to use.
    3. Significant improvements to Workspaces:  Workspaces can now be hierarchical.
    4. Native Composer support included: Includes native Composer support without dependent on third-party projects to set up Drupal along with its dependencies.
    5. Migration improvements: Includes handling of vocabulary language settings, term language information, and localization
  • Keep the Contributed modules up to date. Any Drupal 8 modules with deprecated code need to be updated prior to the release of Drupal 9, or it will stop working with Drupal 9.

    16% of the top 200 Modules are Drupal 9 Ready

[Drupal.org]

  • any custom code on your Drupal 8 site, remove the deprecated code to ensure the compatibility.

 

What is deprecated code?

The Drupal code is said to be “Deprecated” when it should no longer be used anymore and it has a better alternative solution that can be used instead.

How to Know If We Are Using Deprecated Code?

Tools to Identify the deprecated code:

1. drupal-check, allows us to run standalone PHP executable commands and get a report of any deprecated code used. This can be integrated into build processes and continuous integration systems.

Install using Composer like so:

composer require mglaman/drupal-check

To Install Globally run the following command:

composer global require mglaman/drupal-check

Run drupal-check

drupal-check [OPTIONS] [DIRS]

Arguments:

  • OPTIONS – Below are the list of options available.

  • DIRS – Choose one or more directories within the root folder

Options:

  • -a: Check analysis
  • -d: Check deprecation (default)
  • –drupal-rootPath to the Drupal root. Fallback alternative if drupal-check couldn’t recognize Drupal root from the given path(s).

Example:  I have used the address contributed module to check for any deprecated code using the drupal-check command.

drupal-check web/modules/contrib/address
  • Check the address contrib module for deprecation:

drupal-check -d web/modules/contrib/address
  • Check the address contrib module for analysis:

 drupal-check -a web/modules/contrib/address
  • Check the address contrib module for both deprecation and analysis:

  drupal-check -ad web/modules/contrib/address

Drupal Check Analysis Report: Report When we run the drupal-check on the Contrib or Custom Module

Drupal 9 Deprecation Status: We can check all modules or themes deprecation status from the below link​https://dev.acquia.com/drupal9/deprecation_status/errors

2. Upgrade Status Contributed module of Drupal 8, a GUI Based tool where developers can run within the Drupal user interface, providing a complete report to assess the overall compatibility for Drupal 9 site.

Why Upgrade Status Module?

Drupal 8, by default, provides a core module named Update Manager that frequently checks for any updates/newer versions available for the contributed modules and themes and provide the report for the above in the status report. The update manager module doesn’t check for the custom code that is available on the site and does not provide any report on the deprecated code used in the contributed and the custom code. This is where the Upgrade Status module turns out to be useful.

This module scans for all the contributed and custom modules/themes available on the site and provides a report with the available updates and for any deprecated code used.

Steps to Implement:

1. Install the upgrade status module using composer:

  composer require 'drupal/upgrade_status:^1.0'

2. Enable the module:

drush en -y upgrade_status

3. Go to /admin/reports and click on Upgrade Status

4. Select the Project and click on “Scan Selected”. Once the scanning is done, it displays the number of errors and warnings for respective selected projects.

example: I have selected the superfish module and it has 7 errors and 5 warnings. It also shows the number of projects that are not scanned.

5. To export the report, click on Export as HTML. The report would be as:

Conclusion:

Upgradation from Drupal 8 to Drupal 9 will be necessary to ensure the tackling issues like vulnerability, compatibility with new features. It is necessary to make sure that Drupal core, modules and code are always on the latest D8 version as well as ensure that no deprecated module or API is used. In this way, we will be ready for Drupal 9.

For more details on Drupal 9 release and its features, please visit –

https://www.drupal.org/blog/plan-for-drupal-9

https://www.drupal.org/docs/9/how-drupal-9-is-made-and-what-is-included/what-are-the-new-features-of-drupal-9

About The Author