interface ModuleUninstallValidatorInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php \Drupal\Core\Extension\ModuleUninstallValidatorInterface
  2. 8.9.x core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php \Drupal\Core\Extension\ModuleUninstallValidatorInterface
  3. 11.x core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php \Drupal\Core\Extension\ModuleUninstallValidatorInterface

Common interface for module uninstall validators.

A module uninstall validator must implement this interface and be defined in a Drupal service that is tagged module_install.uninstall_validator.

Validators are called during module uninstall and prior to running a configuration import. If different logic is required when uninstalling via configuration import implement ConfigImportModuleUninstallValidatorInterface.

Hierarchy

Expanded class hierarchy of ModuleUninstallValidatorInterface

All classes that implement ModuleUninstallValidatorInterface

See also

\Drupal\Core\Extension\ModuleInstaller::validateUninstall()

\Drupal\Core\EventSubscriber\ConfigImportSubscriber::validateModules()

\Drupal\Core\Extension\ConfigImportModuleUninstallValidatorInterface

5 files declare their use of ModuleUninstallValidatorInterface
BookUninstallValidator.php in core/modules/book/src/BookUninstallValidator.php
ConfigImportSubscriber.php in core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php
ContentUninstallValidator.php in core/lib/Drupal/Core/Entity/ContentUninstallValidator.php
FilterUninstallValidator.php in core/modules/filter/src/FilterUninstallValidator.php
ForumUninstallValidator.php in core/modules/forum/src/ForumUninstallValidator.php

File

core/lib/Drupal/Core/Extension/ModuleUninstallValidatorInterface.php, line 20

Namespace

Drupal\Core\Extension
View source
interface ModuleUninstallValidatorInterface {
    
    /**
     * Determines the reasons a module can not be uninstalled.
     *
     * @param string $module
     *   A module name.
     *
     * @return string[]
     *   An array of reasons the module can not be uninstalled, empty if it can.
     *   Each reason should not end with any punctuation since multiple reasons
     *   can be displayed together.
     *
     * @see template_preprocess_system_modules_uninstall()
     */
    public function validate($module);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
ModuleUninstallValidatorInterface::validate public function Determines the reasons a module can not be uninstalled. 18

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.