You are here

protected function PathautoCommands::getAllowedGenerateActions in Pathauto 8

Returns the allowed actions according to the site configuration.

Return value

array An associative array of allowed option descriptions, keyed by option name.

2 calls to PathautoCommands::getAllowedGenerateActions()
PathautoCommands::interactGenerateAliases in src/Commands/PathautoCommands.php
@hook interact pathauto:aliases-generate
PathautoCommands::validateGenerateAliases in src/Commands/PathautoCommands.php
@hook validate pathauto:aliases-generate

File

src/Commands/PathautoCommands.php, line 261

Class

PathautoCommands
Drush commands allowing to perform Pathauto tasks from the command line.

Namespace

Drupal\pathauto\Commands

Code

protected function getAllowedGenerateActions() {
  $actions = [
    PathautoBulkUpdateForm::ACTION_CREATE => dt('Generate a URL alias for un-aliased paths only.'),
  ];

  // The options that affect existing URL aliases are allowed unless the
  // site is configured to preserve existing aliases.
  $config = $this->configFactory
    ->get('pathauto.settings');
  if ($config
    ->get('update_action') !== PathautoGeneratorInterface::UPDATE_ACTION_NO_NEW) {
    $actions[PathautoBulkUpdateForm::ACTION_UPDATE] = dt('Update the URL alias for paths having an old URL alias.');
    $actions[PathautoBulkUpdateForm::ACTION_ALL] = dt('Regenerate URL aliases for all paths.');
  }
  return $actions;
}