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