public function PathautoCommands::validateGenerateAliases in Pathauto 8
@hook validate pathauto:aliases-generate
Throws
\InvalidArgumentException Thrown when one of the passed arguments is invalid
File
- src/
Commands/ PathautoCommands.php, line 203
Class
- PathautoCommands
- Drush commands allowing to perform Pathauto tasks from the command line.
Namespace
Drupal\pathauto\CommandsCode
public function validateGenerateAliases(CommandData $commandData) {
$input = $commandData
->input();
$action = $input
->getArgument('action');
$valid_actions = array_keys($this
->getAllowedGenerateActions());
if (!in_array($action, $valid_actions)) {
$message = dt('Invalid action argument "@invalid_action". Please use one of: @valid_actions', [
'@invalid_action' => $action,
'@valid_actions' => '"' . implode('", "', $valid_actions) . '"',
]);
throw new \InvalidArgumentException($message);
}
}