Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PluginManager.php

function PluginManager::removePlugin

Removes a plugin, deactivates it and removes any listener the plugin has set on the plugin instance

Ideally plugin packages should be deactivated via deactivatePackage, but if you use Composer programmatically and want to deregister a plugin class directly this is a valid way to do it.

Parameters

PluginInterface $plugin plugin instance:

2 calls to PluginManager::removePlugin()
PluginManager::deactivatePackage in vendor/composer/composer/src/Composer/Plugin/PluginManager.php
Deactivates a plugin package
PluginManager::uninstallPackage in vendor/composer/composer/src/Composer/Plugin/PluginManager.php
Uninstall a plugin package

File

vendor/composer/composer/src/Composer/Plugin/PluginManager.php, line 410

Class

PluginManager
Plugin manager

Namespace

Composer\Plugin

Code

public function removePlugin(PluginInterface $plugin) : void {
    $index = array_search($plugin, $this->plugins, true);
    if ($index === false) {
        return;
    }
    $this->io
        ->writeError('Unloading plugin ' . get_class($plugin), true, IOInterface::DEBUG);
    unset($this->plugins[$index]);
    $plugin->deactivate($this->composer, $this->io);
    $this->composer
        ->getEventDispatcher()
        ->removeListener($plugin);
}
RSS feed
Powered by Drupal