public function PathautoCommands::generateAliases in Pathauto 8
(Re)generate URL aliases.
@command pathauto:aliases-generate
@usage drush pathauto:aliases-generate all all Generate all URL aliases. @usage drush pathauto:aliases-generate create canonical_entities:node Generate URL aliases for un-aliased node paths only. @usage drush pathauto:aliases-generate When the arguments are omitted they can be chosen from an interactive menu.
@aliases pag
Parameters
string $action: The action to take. Possible actions are "create" (generate aliases for un-aliased paths only), "update" (update aliases for paths that have an existing alias) or "all" (generate aliases for all paths).
array $types: Comma-separated list of aliase typess to generate. Pass "all" to generate aliases for all types.
Throws
\Exception
File
- src/
Commands/ PathautoCommands.php, line 89
Class
- PathautoCommands
- Drush commands allowing to perform Pathauto tasks from the command line.
Namespace
Drupal\pathauto\CommandsCode
public function generateAliases($action = NULL, array $types = NULL) {
$batch = [
'title' => dt('Bulk updating URL aliases'),
'operations' => [
[
'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchStart',
[],
],
],
'finished' => 'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchFinished',
'progressive' => FALSE,
];
foreach ($types as $type) {
$batch['operations'][] = [
'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchProcess',
[
$type,
$action,
],
];
}
batch_set($batch);
drush_backend_batch_process();
}