You are here

public function PathautoCommands::getAliasTypes in Pathauto 8

Returns the available alias types for which aliases can be generated.

Return value

array An indexed array of alias types.

Throws

\Drupal\Component\Plugin\Exception\PluginException Thrown when an alias type can not be instantiated.

3 calls to PathautoCommands::getAliasTypes()
PathautoCommands::deleteAliases in src/Commands/PathautoCommands.php
Delete URL aliases
PathautoCommands::interactAliasTypes in src/Commands/PathautoCommands.php
@hook interact
PathautoCommands::validateAliaseTypes in src/Commands/PathautoCommands.php
@hook validate

File

src/Commands/PathautoCommands.php, line 286

Class

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

Namespace

Drupal\pathauto\Commands

Code

public function getAliasTypes() {
  $types = [];
  foreach ($this->aliasTypeManager
    ->getVisibleDefinitions() as $id => $definition) {

    /** @var \Drupal\pathauto\AliasTypeInterface $aliasType */
    $aliasType = $this->aliasTypeManager
      ->createInstance($id);
    if ($aliasType instanceof AliasTypeBatchUpdateInterface) {
      $types[] = $aliasType
        ->getPluginId();
    }
  }
  return $types;
}