Commit 66b0fda9 authored by pfrenssen's avatar pfrenssen Committed by Berdir

Issue #2717721 by pfrenssen, LammensJ, Adita, gaurav.kapoor, Prashant.c: Drush...

Issue #2717721 by pfrenssen, LammensJ, Adita, gaurav.kapoor, Prashant.c: Drush commands for bulk alias updates
parent c934443a
services:
pathauto.commands:
class: \Drupal\pathauto\Commands\PathautoCommands
arguments:
- '@config.factory'
- '@plugin.manager.alias_type'
- '@pathauto.alias_storage_helper'
tags:
- { name: drush.command }
This diff is collapsed.
...@@ -15,6 +15,21 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -15,6 +15,21 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/ */
class PathautoBulkUpdateForm extends FormBase { class PathautoBulkUpdateForm extends FormBase {
/**
* Generate URL aliases for un-aliased paths only.
*/
const ACTION_CREATE = 'create';
/**
* Update URL aliases for paths that have an existing alias.
*/
const ACTION_UPDATE = 'update';
/**
* Regenerate URL aliases for all paths.
*/
const ACTION_ALL = 'all';
/** /**
* The alias type manager. * The alias type manager.
* *
...@@ -76,8 +91,8 @@ class PathautoBulkUpdateForm extends FormBase { ...@@ -76,8 +91,8 @@ class PathautoBulkUpdateForm extends FormBase {
$form['action'] = [ $form['action'] = [
'#type' => 'radios', '#type' => 'radios',
'#title' => $this->t('Select which URL aliases to generate'), '#title' => $this->t('Select which URL aliases to generate'),
'#options' => ['create' => $this->t('Generate a URL alias for un-aliased paths only')], '#options' => [static::ACTION_CREATE => $this->t('Generate a URL alias for un-aliased paths only')],
'#default_value' => 'create', '#default_value' => static::ACTION_CREATE,
]; ];
$config = $this->config('pathauto.settings'); $config = $this->config('pathauto.settings');
...@@ -89,8 +104,8 @@ class PathautoBulkUpdateForm extends FormBase { ...@@ -89,8 +104,8 @@ class PathautoBulkUpdateForm extends FormBase {
]; ];
} }
else { else {
$form['action']['#options']['update'] = $this->t('Update the URL alias for paths having an old URL alias'); $form['action']['#options'][static::ACTION_UPDATE] = $this->t('Update the URL alias for paths having an old URL alias');
$form['action']['#options']['all'] = $this->t('Regenerate URL aliases for all paths'); $form['action']['#options'][static::ACTION_ALL] = $this->t('Regenerate URL aliases for all paths');
} }
$form['actions']['#type'] = 'actions'; $form['actions']['#type'] = 'actions';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment