You are here

public function ImageEffectsUninstallValidator::validate in Image Effects 8.2

Same name in this branch
  1. 8.2 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator::validate()
  2. 8.2 src/ProxyClass/ImageEffectsUninstallValidator.php \Drupal\image_effects\ProxyClass\ImageEffectsUninstallValidator::validate()
Same name and namespace in other branches
  1. 8.3 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator::validate()
  2. 8 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator::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/ImageEffectsUninstallValidator.php, line 40

Class

ImageEffectsUninstallValidator
Prevents uninstalling modules that Image Effects configuration require.

Namespace

Drupal\image_effects

Code

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

  // Prevents uninstalling 'jquery_colorpicker' if its color selector plugin
  // is in use.
  if ($module == 'jquery_colorpicker' && $this->configFactory
    ->get('image_effects.settings')
    ->get('color_selector.plugin_id') === 'jquery_colorpicker') {
    $reasons[] = $this
      ->t('The <em>Image Effects</em> module is using the <em>JQuery Colorpicker</em> color selector');
  }
  return $reasons;
}