public function WarmerCommands::validateWarmerNames in Warmer 2.x
Same name and namespace in other branches
- 8 src/Commands/WarmerCommands.php \Drupal\warmer\Commands\WarmerCommands::validateWarmerNames()
Validate that queue permission exists.
Annotation value should be the name of the argument/option containing the name.
@hook validate @validate-warmer
Parameters
\Consolidation\AnnotatedCommand\CommandData $commandData:
Return value
\Consolidation\AnnotatedCommand\CommandError|NULL
File
- src/
Commands/ WarmerCommands.php, line 159
Class
- WarmerCommands
- Drush commands for the Warmer module.
Namespace
Drupal\warmer\CommandsCode
public function validateWarmerNames(CommandData $commandData) {
$arg_name = $commandData
->annotationData()
->get('validate-warmer', null);
$warmer_ids = $commandData
->input()
->getArgument($arg_name);
$warmer_ids = StringUtils::csvToArray($warmer_ids);
$definitions = $this->warmerManager
->getDefinitions();
$actual_warmer_ids = array_keys($definitions);
$missing = array_diff($warmer_ids, $actual_warmer_ids);
if (!empty($missing)) {
$message = dt('Warmer plugin(s) not found: !names.', [
'!names' => implode(', ', $missing),
]);
return new CommandError($message);
}
return NULL;
}