Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291708

Uninstalling a module providing display extenders causes fatal errors

$
0
0

Just noticed something that could pose big problems as more modules come out that extend Views. If you define a Display Extender plugin in a module and enable it, then uninstall that module, you are unable to load any pages. You get a "Drupal\Component\Plugin\Exception\PluginNotFoundException" error.

Not sure the best way to fix this. Simplest fix would be in DisplayPluginBase.php:165:

if ($plugin = $manager->createInstance($extender)) {

Change to:

if ($manager->hasDefinition($extender) && $plugin = $manager->createInstance($extender)) {

The other, more involved but possible better option would be to define a default fallback plugin for display extenders, and possibly any other Views plugins that can be defined and cause this problem.

Update from comment 2:

The same thing will occur if a module defines an input filter and then that module is uninstalled. If you go to a page with processed text using a format that filter was enabled in, then it will error out with a plugin not found exception.

Per @cilefen in #1, what may be the best solution is to include these plugins, along with any others in the uninstall validator. Thinking off the top of my head, perhaps a new method in DefaultPluginManager (or even a trait for plugin managers to include) that allows each plugin manager to perform a check if it can be safely removed or not.

eg for the views handler (spit balling off the top of my head):

public function uninstallRequirements($module_name) {

  foreach ($definitions as $definition) {
      if ($definition['provider'] == $module_name && $config->get('views.settings.display_extenders' . $definition['id'])) {
          //Throw an exception or return an explanation of why this module can not be uninstalled.
     }
  }
}

For Filters it would have to loop through each formatter config entity and check if that filter is enabled.

I'm sure there are other plugins that can cause this issue, so it might be worth spending some time to investigate. While we can check uninstall requirements on a per-module basis, having core do this would make much more sense and prevent the dreaded WSOD as more modules get tried and uninstalled.


Viewing all articles
Browse latest Browse all 291708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>