Skip to content

Instantly share code, notes, and snippets.

@davefreiman
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davefreiman/ea5d0324ce974be2b98f to your computer and use it in GitHub Desktop.
Save davefreiman/ea5d0324ce974be2b98f to your computer and use it in GitHub Desktop.
/**
* Retrieve route URL
*
* @param string $routePath
* @param array $routeParams
*
* @return string
*/
public function getRouteUrl($routePath = null, $routeParams = null)
{
$this->unsetData('route_params');
if (isset($routeParams['_direct'])) {
if (is_array($routeParams)) {
$this->setRouteParams($routeParams, false);
}
return $this->getBaseUrl() . $routeParams['_direct'];
}
if (!is_null($routePath)) {
$this->setRoutePath($routePath);
}
if (is_array($routeParams)) {
$this->setRouteParams($routeParams, false);
}
$url = $this->getBaseUrl() . $this->getRoutePath($routeParams);
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment