class ImageEffectsUninstallValidator in Image Effects 8
Same name in this branch
- 8 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator
- 8 src/ProxyClass/ImageEffectsUninstallValidator.php \Drupal\image_effects\ProxyClass\ImageEffectsUninstallValidator
Same name and namespace in other branches
- 8.3 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator
- 8.2 src/ImageEffectsUninstallValidator.php \Drupal\image_effects\ImageEffectsUninstallValidator
Prevents uninstalling modules that Image Effects configuration require.
Hierarchy
- class \Drupal\image_effects\ImageEffectsUninstallValidator implements ModuleUninstallValidatorInterface uses StringTranslationTrait
Expanded class hierarchy of ImageEffectsUninstallValidator
1 string reference to 'ImageEffectsUninstallValidator'
1 service uses ImageEffectsUninstallValidator
File
- src/
ImageEffectsUninstallValidator.php, line 13
Namespace
Drupal\image_effectsView source
class ImageEffectsUninstallValidator implements ModuleUninstallValidatorInterface {
use StringTranslationTrait;
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new ImageEffectsUninstallValidator.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(ConfigFactoryInterface $config_factory, TranslationInterface $string_translation) {
$this->configFactory = $config_factory;
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ImageEffectsUninstallValidator:: |
protected | property | The configuration factory. | |
ImageEffectsUninstallValidator:: |
public | function |
Determines the reasons a module can not be uninstalled. Overrides ModuleUninstallValidatorInterface:: |
|
ImageEffectsUninstallValidator:: |
public | function | Constructs a new ImageEffectsUninstallValidator. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |