Skip to content
Snippets Groups Projects
Commit c5b53785 authored by Joas Schilling's avatar Joas Schilling
Browse files

Add a method to get the absolute url for a route

Fix #10926
parent 637cff68
No related branches found
No related tags found
No related merge requests found
......@@ -35,13 +35,26 @@ class URLGenerator implements IURLGenerator {
* @internal param array $args with param=>value, will be appended to the returned url
* @return string the url
*
* Returns a url to the given app and file.
* Returns a url to the given route.
*/
public function linkToRoute($route, $parameters = array()) {
$urlLinkTo = \OC::$server->getRouter()->generate($route, $parameters);
return $urlLinkTo;
}
/**
* Creates an absolute url using a defined route
* @param string $route
* @param array $parameters
* @internal param array $args with param=>value, will be appended to the returned url
* @return string the url
*
* Returns an absolute url to the given route.
*/
public function linkToRouteAbsolute($routeName, $arguments = array()) {
return $this->getAbsoluteURL($this->linkToRoute($routeName, $arguments));
}
/**
* Creates an url
* @param string $app app
......
......@@ -42,6 +42,14 @@ interface IURLGenerator {
*/
public function linkToRoute($routeName, $arguments = array());
/**
* Returns the absolute URL for a route
* @param string $routeName the name of the route
* @param array $arguments an array with arguments which will be filled into the url
* @return string the absolute url
*/
public function linkToRouteAbsolute($routeName, $arguments = array());
/**
* Returns an URL for an image or file
* @param string $appName the name of the app
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment