API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

IBM API Connect : Preparations for upgrading your Developer Portal to Drupal 11

By Johns Thomas posted 9 days ago

  

With the release of API Connect version 10.0.10.0, the Developer Portal will be upgraded to Drupal 11. 

If your Developer Portal contains custom modules and themes, whether created by you or downloaded from elsewhere, it's crucial to ensure they are compatible with Drupal 11 before upgrading. This preparation will help ensure a seamless APIC upgrade experience. Fortunately, there's a handy module called Upgrade status that provides detailed information on your modules and themes and how they can make Drupal 11 compatible. You can download it here. https://www.drupal.org/project/upgrade_status  

 

For a seamless experience, it is recommended to remove themes and modules that you actually don’t use. It will save you some time in preparing your developer portal to be Drupal 11 compatible. 

I am going to show you how you prepare you developer portal for upgrade. The intention is to give brief idea about what needs to be in prior to upgrade.

Log into your Developer Portal as administrator and install the Upgrade status module.  You can install the module from the UI, although Drupal 11 removed the support for installing modules/themes via the UI, we have retained it in the Developer portal for you. Once installation is completed, go to Admin > Reports > Upgrade-status

UI of Upgrade Status module

When upgrading to Drupal 11, you can ignore the Drupal core and hosting environment section, as this is managed by IBM API Connect and will be resolved upon completion of the upgrade. 

Important: Ensure that your custom modules and themes are PHP 8.3 compatible before upgrading to Drupal 11. This is your responsibility. 

Scrolling down you can see the Upgrade status module displays a list of projects not compatible with Drupal 11. It categorizes these projects into different sections, such as Remove, Update, and Collaborate with Maintainers, to help you manage the upgrade process effectively. 

Note: When you upgrade IBM API Connect, all IBM supplied modules and themes will be automatically updated to be Drupal 11 compatible.

 

Familiarise upgrade status module

When you find your custom modules and themes listed on the Drupal 11 upgrade status page, simply select them and click Scan Selected. This action will reveal the necessary changes to make them Drupal 11 compatible. 

Scanning a module for Drupal 11 compatibility

If updates are required for your custom module or theme, you'll see a link to the corresponding themes or modules once the scan is complete. For instance, the image below demonstrates the process of scanning an installed custom module named Masonry API.

Viewing issues identified by Upgrade status module

Note: For the Upgrade status module to identify all the Drupal 11 compatibility issues in your custom modules and themes, you must enable the custom modules and themes before scanning it. 

 

To get a clear view of your module's status, click Export as HTML

Viewing Report in HTML

Next, update the version in the info.yml file and modify the code for any deprecated functions to ensure your module is compatible with Drupal 11. 

Once your module is updated, reinstall it using the Developer Portal UI. Finally, return to the Upgrade Status report page and rescan the module to verify its compatibility with Drupal 11. 

Example of upgrading a module to be Drupal 11 compatible 

This module serves as an example of how you can read the upgrade report and adjust your code to ensure compatibility with Drupal 11. 

Add the new version to the info.yml file to reflect Drupal 11 compatibility as shown in the below image. 

Keep Drupal/Core/Extension/ExtensionList as it is, since it remains present in both Drupal 9 and Drupal 10. Ensure it supports Drupal 11 as well. 

Changing core version requirement

When upgrading your custom module to be compatible with Drupal 11, you might encounter scenarios where changes in the constructor are necessary. For example, consider the following code snippet: 

In this scenario, the constructor has been updated to include TypedConfigManagerInterface as a new dependency. This change ensures that your module aligns with the updated requirements of Drupal 11. 

Example showing the changes using constructor of ConfigFormBase in Drupal 11

To implement this update: 

  • Modify the constructor: Add the new TypedConfigManagerInterface parameter to the constructor and update the parent constructor call accordingly. 

  • Similarly, you have to check any other modifications are necessary to ensure Drupal 11 compatibility, as we can not demonstrate everything here.

  • After completing the modification, Import the module by using the Developer Portal Toolkit CLI. For more information about how to use the Developer Portal CLI, see Getting started with the Portal CLI commands. Alternatively, you can install it using the Developer Portal UI 

  • Verify compatibility: Return to the Upgrade status report page and rescan the module to confirm it is now compatible with Drupal 11. When it becomes compatible with Drupal 11, it appears at the end of the page.

Status of the module in upgrade status module after adding Drupal 11 compatibility

By following these steps, you can ensure a smooth transition to Drupal 11 for your custom modules. 

 

So, we have seen an example of modifying a custom module to be Drupal 11 compatible. By staying informed about the key changes, deprecations, and necessary updates, you can ensure a smooth transition and maintain the functionality and security of your site.  

0 comments
21 views

Permalink