You are here

D8 Notes: Remove Plugin Usages Before Uninstalling A Module

In this Drupal 8 note, I want to discuss a nasty little bug I found yesterday, which could lead to some serious problems for module developers.

Drupal 8 introduced the new Plugin system, which is an amazing way to allow modules to be extended. To say I've become a fan would be an understatement.

But disaster hit yesterday. While working on a module that creates a View's display extender plugin, I had to uninstall the module. Once I did, I got hit with WSOD (WSOEM - actual White Screen Of Error Messages). The error was:

Drupal\Component\Plugin\Exception\PluginNotFoundException

After some digging it turns out that views was still trying to load my plugin, from the module I had just uninstalled.

I did some further testing and found out this isn't exclusive to display extender plugins. Another problem area I found was in Filters. If your module creates a new input Filter and it's assigned to a format, then you uninstall that module, anytime the format(s) using that filter are called with result in the above error.

I have opened an issue on this and Catch has elevated it to a critical issue. Until that gets fixed, just make sure if you're working on developing a module that uses plugins to be sure to disable them before uninstalling your module.