Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Routing / RedirectDestinationInterface.php
1 <?php
2
3 namespace Drupal\Core\Routing;
4
5 /**
6  * Provides an interface for redirect destinations.
7  */
8 interface RedirectDestinationInterface {
9
10   /**
11    * Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
12    *
13    * Used to direct the user back to the referring page after completing a form.
14    * By default the current URL is returned. If a destination exists in the
15    * current request, that destination is returned. As such, a destination can
16    * persist across multiple pages.
17    *
18    * @return array
19    *   An associative array containing the key:
20    *   - destination: The value of the current request's 'destination' query
21    *     parameter, if present. This can be either a relative or absolute URL.
22    *     However, for security, redirection to external URLs is not performed.
23    *     If the query parameter isn't present, then the URL of the current
24    *     request is returned.
25    *
26    * @see \Drupal\Core\EventSubscriber\RedirectResponseSubscriber::checkRedirectUrl()
27    * @ingroup form_api
28    */
29   public function getAsArray();
30
31   /**
32    * Gets the destination as a path.
33    *
34    * To convert to a URL suitable for
35    * \Symfony\Component\HttpFoundation\RedirectResponse::__construct() use
36    * @code
37    * \Drupal\Core\Url::fromUserInput(\Drupal::destination()->get())->setAbsolute()->toString()
38    * @endcode
39    *
40    * @return string
41    */
42   public function get();
43
44   /**
45    * Sets the destination as URL.
46    *
47    * This method should be used really rarely, for example views uses it, in
48    * order to override all destination calls in all of its rendering.
49    *
50    * @param string $new_destination
51    *   The new destination.
52    *
53    * @return $this
54    */
55   public function set($new_destination);
56
57 }