Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Routing / UrlGeneratorInterface.php
1 <?php
2
3 namespace Drupal\Core\Routing;
4
5 use Symfony\Cmf\Component\Routing\VersatileGeneratorInterface;
6
7 /**
8  * Defines an interface for generating a url from a route or system path.
9  *
10  * Provides additional methods and options not present in the base interface.
11  */
12 interface UrlGeneratorInterface extends VersatileGeneratorInterface {
13
14   /**
15    * Gets the internal path (system path) for a route.
16    *
17    * @param string|\Symfony\Component\Routing\Route $name
18    *   The route name or a route object.
19    * @param array $parameters
20    *   An array of parameters as passed to
21    *   \Symfony\Component\Routing\Generator\UrlGeneratorInterface::generate().
22    *
23    * @return string
24    *   The internal Drupal path corresponding to the route. This string is
25    *   not urlencoded and will be an empty string for the front page.
26    */
27   public function getPathFromRoute($name, $parameters = []);
28
29   /**
30    * Generates a URL or path for a specific route based on the given parameters.
31    *
32    * Parameters that reference placeholders in the route pattern will be
33    * substituted for them in the pattern. Extra params are added as query
34    * strings to the URL.
35    *
36    * @param string|\Symfony\Component\Routing\Route $name
37    *   The route name or a route object.
38    * @param array $parameters
39    *   An associative array of parameter names and values.
40    * @param array $options
41    *   (optional) An associative array of additional options, with the following
42    *   elements:
43    *   - 'query': An array of query key/value-pairs (without any URL-encoding)
44    *     to append to the URL.
45    *   - 'fragment': A fragment identifier (named anchor) to append to the URL.
46    *     Do not include the leading '#' character.
47    *   - 'absolute': Defaults to FALSE. Whether to force the output to be an
48    *     absolute link (beginning with http:). Useful for links that will be
49    *     displayed outside the site, such as in an RSS feed.
50    *   - 'language': An optional language object used to look up the alias
51    *     for the URL. If $options['language'] is omitted, it defaults to the
52    *     current language for the language type LanguageInterface::TYPE_URL.
53    *   - 'https': Whether this URL should point to a secure location. If not
54    *     defined, the current scheme is used, so the user stays on HTTP or HTTPS
55    *     respectively. TRUE enforces HTTPS and FALSE enforces HTTP.
56    *   - 'base_url': Only used internally by a path processor, for example, to
57    *     modify the base URL when a language dependent URL requires so.
58    *   - 'prefix': Only used internally, to modify the path when a language
59    *     dependent URL requires so.
60    * @param bool $collect_bubbleable_metadata
61    *   (optional) Defaults to FALSE. When TRUE, both the generated URL and its
62    *   associated bubbleable metadata are returned.
63    *
64    * @return string|\Drupal\Core\GeneratedUrl
65    *   The generated URL for the given route.
66    *   When $collect_bubbleable_metadata is TRUE, a GeneratedUrl object is
67    *   returned, containing the generated URL plus bubbleable metadata.
68    *
69    * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException
70    *   Thrown when the named route does not exist.
71    * @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
72    *   Thrown when some parameters are missing that are mandatory for the route.
73    * @throws \Symfony\Component\Routing\Exception\InvalidParameterException
74    *   Thrown when a parameter value for a placeholder is not correct because it
75    *   does not match the requirement.
76    *
77    * @internal
78    *   Should not be used in user code.
79    *   Use \Drupal\Core\Url instead.
80    */
81   public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE);
82
83 }