/Drupal 8

public function RedirectDestinationInterface::getAsArray

public RedirectDestinationInterface::getAsArray()

Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.

Used to direct the user back to the referring page after completing a form. By default the current URL is returned. If a destination exists in the current request, that destination is returned. As such, a destination can persist across multiple pages.

Return value

array An associative array containing the key:

  • destination: The value of the current request's 'destination' query parameter, if present. This can be either a relative or absolute URL. However, for security, redirection to external URLs is not performed. If the query parameter isn't present, then the URL of the current request is returned.

See also


Related topics

Form generation
Describes how to generate and manipulate forms and process form submissions.


core/lib/Drupal/Core/Routing/RedirectDestinationInterface.php, line 29


Provides an interface for redirect destinations.




public function getAsArray();

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.