You are here

public function FilebrowserUninstallValidator::validate in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x src/FilebrowserUninstallValidator.php \Drupal\filebrowser\FilebrowserUninstallValidator::validate()

Determines the reasons a module can not be uninstalled.

Parameters

string $module: A module name.

Return value

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.

Overrides ModuleUninstallValidatorInterface::validate

See also

template_preprocess_system_modules_uninstall()

File

src/FilebrowserUninstallValidator.php, line 41

Class

FilebrowserUninstallValidator

Namespace

Drupal\filebrowser

Code

public function validate($module) {
  $reasons = [];
  if ($module == 'filebrowser') {

    // The Filebrowser node type is provided by the Filebrowser module. Prevent uninstall
    // if there are any nodes of that type.
    if ($this
      ->hasNodes()) {
      $reasons[] = $this
        ->t('To uninstall Filebrowser, delete all nodes of type %type', [
        '%type' => 'dir_listing',
      ]);
    }
  }
  return $reasons;
}