mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/13036] Make the reference type configurable when generating a route
PHPBB3-13036
This commit is contained in:
parent
b3576d77da
commit
dab6b99bcd
1 changed files with 5 additions and 3 deletions
|
@ -15,6 +15,7 @@ namespace phpbb\controller;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Generator\UrlGenerator;
|
use Symfony\Component\Routing\Generator\UrlGenerator;
|
||||||
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
use Symfony\Component\Routing\RequestContext;
|
use Symfony\Component\Routing\RequestContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,10 +116,11 @@ class helper
|
||||||
* @param string $route Name of the route to travel
|
* @param string $route Name of the route to travel
|
||||||
* @param array $params String or array of additional url parameters
|
* @param array $params String or array of additional url parameters
|
||||||
* @param bool $is_amp Is url using & (true) or & (false)
|
* @param bool $is_amp Is url using & (true) or & (false)
|
||||||
* @param string|bool $session_id Possibility to use a custom session id instead of the global one
|
* @param string|bool $session_id Possibility to use a custom session id instead of the global one
|
||||||
|
* @param bool|string $reference_type The type of reference to be generated (one of the constants)
|
||||||
* @return string The URL already passed through append_sid()
|
* @return string The URL already passed through append_sid()
|
||||||
*/
|
*/
|
||||||
public function route($route, array $params = array(), $is_amp = true, $session_id = false)
|
public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||||
{
|
{
|
||||||
$anchor = '';
|
$anchor = '';
|
||||||
if (isset($params['#']))
|
if (isset($params['#']))
|
||||||
|
@ -146,7 +148,7 @@ class helper
|
||||||
$context->setBaseUrl($base_url);
|
$context->setBaseUrl($base_url);
|
||||||
|
|
||||||
$url_generator = new UrlGenerator($this->route_collection, $context);
|
$url_generator = new UrlGenerator($this->route_collection, $context);
|
||||||
$route_url = $url_generator->generate($route, $params);
|
$route_url = $url_generator->generate($route, $params, $reference_type);
|
||||||
|
|
||||||
if ($is_amp)
|
if ($is_amp)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue