interface ModuleUninstallValidatorInterface in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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.
Hierarchy
- interface \Drupal\Core\Extension\ModuleUninstallValidatorInterface
Expanded class hierarchy of ModuleUninstallValidatorInterface
All classes that implement ModuleUninstallValidatorInterface
6 files declare their use of ModuleUninstallValidatorInterface
- BookUninstallValidator.php in core/
modules/ book/ src/ BookUninstallValidator.php - Contains \Drupal\book\BookUninstallValidator.
- ContentUninstallValidator.php in core/
lib/ Drupal/ Core/ Entity/ ContentUninstallValidator.php - Contains \Drupal\Core\Entity\ContentUninstallValidator.
- FieldModuleUninstallValidator.php in core/
lib/ Drupal/ Core/ Field/ FieldModuleUninstallValidator.php - Contains \Drupal\Core\Field\FieldModuleUninstallValidator.
- FieldUninstallValidator.php in core/
modules/ field/ src/ FieldUninstallValidator.php - Contains \Drupal\field\FieldUninstallValidator.
- FilterUninstallValidator.php in core/
modules/ filter/ src/ FilterUninstallValidator.php - Contains \Drupal\filter\FilterUninstallValidator.
File
- core/
lib/ Drupal/ Core/ Extension/ ModuleUninstallValidatorInterface.php, line 17 - Contains \Drupal\Core\Extension\ModuleUninstallValidatorInterface.
Namespace
Drupal\Core\ExtensionView source
interface ModuleUninstallValidatorInterface {
/**
* Determines the reasons a module can not be uninstalled.
*
* Example implementation:
* @code
* public function validate($module) {
* $entity_types = $this->entityManager->getDefinitions();
* $reasons = array();
* foreach ($entity_types as $entity_type) {
* if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) {
* $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel()));
* }
* }
* return $reasons;
* }
* @endcode
*
* @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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ModuleUninstallValidatorInterface:: |
public | function | Determines the reasons a module can not be uninstalled. | 14 |