class MaestroNonInteractiveExampleTaskUninstallValidator in Maestro 8.2
Same name in this branch
- 8.2 modules/examples/maestro_noninteractive_task_plugin_example/src/MaestroNonInteractiveExampleTaskUninstallValidator.php \Drupal\maestro_noninteractive_task_plugin_example\MaestroNonInteractiveExampleTaskUninstallValidator
- 8.2 modules/examples/maestro_noninteractive_task_plugin_example/src/ProxyClass/MaestroNonInteractiveExampleTaskUninstallValidator.php \Drupal\maestro_noninteractive_task_plugin_example\ProxyClass\MaestroNonInteractiveExampleTaskUninstallValidator
Same name and namespace in other branches
- 3.x modules/examples/maestro_noninteractive_task_plugin_example/src/MaestroNonInteractiveExampleTaskUninstallValidator.php \Drupal\maestro_noninteractive_task_plugin_example\MaestroNonInteractiveExampleTaskUninstallValidator
Prevents example task module from being uninstalled when the task is bound in a template.
Hierarchy
- class \Drupal\maestro_noninteractive_task_plugin_example\MaestroNonInteractiveExampleTaskUninstallValidator implements ModuleUninstallValidatorInterface uses StringTranslationTrait
Expanded class hierarchy of MaestroNonInteractiveExampleTaskUninstallValidator
1 string reference to 'MaestroNonInteractiveExampleTaskUninstallValidator'
- maestro_noninteractive_task_plugin_example.services.yml in modules/
examples/ maestro_noninteractive_task_plugin_example/ maestro_noninteractive_task_plugin_example.services.yml - modules/examples/maestro_noninteractive_task_plugin_example/maestro_noninteractive_task_plugin_example.services.yml
1 service uses MaestroNonInteractiveExampleTaskUninstallValidator
- maestro_noninteractive_task_plugin_example.uninstall_validator in modules/
examples/ maestro_noninteractive_task_plugin_example/ maestro_noninteractive_task_plugin_example.services.yml - Drupal\maestro_noninteractive_task_plugin_example\MaestroNonInteractiveExampleTaskUninstallValidator
File
- modules/
examples/ maestro_noninteractive_task_plugin_example/ src/ MaestroNonInteractiveExampleTaskUninstallValidator.php, line 13
Namespace
Drupal\maestro_noninteractive_task_plugin_exampleView source
class MaestroNonInteractiveExampleTaskUninstallValidator implements ModuleUninstallValidatorInterface {
use StringTranslationTrait;
/**
* Constructs a new MaestroExampleTaskUninstallValidator.
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(TranslationInterface $string_translation) {
// We only use string translation in this validator, the rest is up to the Maestro Engine.
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
public function validate($module) {
$reasons = [];
if ($module == 'maestro_noninteractive_task_plugin_example') {
// Cycle through all of the Maestro templates and determine if any of the tasks are of type MaestroNonIntExample.
$templates = MaestroEngine::getTemplates();
foreach ($templates as $template) {
foreach ($template->tasks as $task) {
if ($task['tasktype'] == 'MaestroNonIntExample') {
$reasons[] = $this
->t('To uninstall the Non Interactive Plugin Task Example module, remove the Non Interactive Example task from the <em>:template</em> template.', [
':template' => $template->label,
]);
}
}
}
}
return $reasons;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MaestroNonInteractiveExampleTaskUninstallValidator:: |
public | function |
Determines the reasons a module can not be uninstalled. Overrides ModuleUninstallValidatorInterface:: |
|
MaestroNonInteractiveExampleTaskUninstallValidator:: |
public | function | Constructs a new MaestroExampleTaskUninstallValidator. | |
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. |