Skip to content

Commit

Permalink
API Add AbsoluteLink method to RequestHandler
Browse files Browse the repository at this point in the history
This is a method that is commonly implemented on controllers, but
it really doesn't need to be.
  • Loading branch information
GuySartorelli committed Apr 5, 2023
1 parent 2c874a1 commit b4ac201
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Control/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,17 @@ public function Link($action = null)
return null;
}

/**
* Get the absolute URL for this controller, including protocol and host.
*
* @param string $action See {@link Link()}
* @return string
*/
public function AbsoluteLink($action = '')
{
return Director::absoluteURL((string) $this->Link($action));
}

/**
* Redirect to the given URL.
*/
Expand Down

0 comments on commit b4ac201

Please sign in to comment.