OutboundPathProcessorInterface.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Drupal\Core\PathProcessor;
  3. use Drupal\Core\Render\BubbleableMetadata;
  4. use Symfony\Component\HttpFoundation\Request;
  5. /**
  6. * Defines an interface for classes that process the outbound path.
  7. */
  8. interface OutboundPathProcessorInterface {
  9. /**
  10. * Processes the outbound path.
  11. *
  12. * @param string $path
  13. * The path to process, with a leading slash.
  14. * @param array $options
  15. * (optional) An associative array of additional options, with the following
  16. * elements:
  17. * - 'query': An array of query key/value-pairs (without any URL-encoding)
  18. * to append to the URL.
  19. * - 'fragment': A fragment identifier (named anchor) to append to the URL.
  20. * Do not include the leading '#' character.
  21. * - 'absolute': Defaults to FALSE. Whether to force the output to be an
  22. * absolute link (beginning with http:). Useful for links that will be
  23. * displayed outside the site, such as in an RSS feed.
  24. * - 'language': An optional language object used to look up the alias
  25. * for the URL. If $options['language'] is omitted, it defaults to the
  26. * current language for the language type LanguageInterface::TYPE_URL.
  27. * - 'https': Whether this URL should point to a secure location. If not
  28. * defined, the current scheme is used, so the user stays on HTTP or HTTPS
  29. * respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
  30. * - 'base_url': Only used internally by a path processor, for example, to
  31. * modify the base URL when a language dependent URL requires so.
  32. * - 'prefix': Only used internally, to modify the path when a language
  33. * dependent URL requires so.
  34. * - 'route': The route object for the given path. It will be set by
  35. * \Drupal\Core\Routing\UrlGenerator::generateFromRoute().
  36. * @param \Symfony\Component\HttpFoundation\Request $request
  37. * The HttpRequest object representing the current request.
  38. * @param \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata
  39. * (optional) Object to collect path processors' bubbleable metadata.
  40. *
  41. * @return string
  42. * The processed path.
  43. */
  44. public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL);
  45. }