AliasUniquifierInterface.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\pathauto;
  3. use Drupal\Core\Language\LanguageInterface;
  4. /**
  5. * Provides an interface for alias uniquifiers.
  6. */
  7. interface AliasUniquifierInterface {
  8. /**
  9. * Check to ensure a path alias is unique and add suffix variants if necessary.
  10. *
  11. * Given an alias 'content/test' if a path alias with the exact alias already
  12. * exists, the function will change the alias to 'content/test-0' and will
  13. * increase the number suffix until it finds a unique alias.
  14. *
  15. * @param string $alias
  16. * A string with the alias. Can be altered by reference.
  17. * @param string $source
  18. * A string with the path source.
  19. * @param string $langcode
  20. * A string with a language code.
  21. */
  22. public function uniquify(&$alias, $source, $langcode);
  23. /**
  24. * Checks if an alias is reserved.
  25. *
  26. * @param string $alias
  27. * The alias.
  28. * @param string $source
  29. * The source.
  30. * @param string $langcode
  31. * (optional) The language code.
  32. *
  33. * @return bool
  34. * Returns TRUE if the alias is reserved.
  35. */
  36. public function isReserved($alias, $source, $langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED);
  37. }