Commit 90c7a9c2 by Alexander Makarov

Fixes #6464: `path` and `url` weren't resolving aliases

parent ae2f4cfe
......@@ -4,7 +4,7 @@ Yii Framework 2 twig extension Change Log
2.0.2 under development
-----------------------
- no changes in this release.
- Bug #6464: `path` and `url` weren't resolving aliases (samdark, lynicidn)
2.0.1 December 07, 2014
......
......@@ -177,14 +177,34 @@ class Extension extends \Twig_Extension
}
}
/**
* Generates relative URL
*
* @param string $path the parameter to be used to generate a valid URL
* @param array $args arguments
* @return string the generated relative URL
*/
public function path($path, $args = [])
{
return Url::to(array_merge([$path], $args));
if ($args !== []) {
$path = array_merge([$path], $args);
}
return Url::to($path);
}
/**
* Generates absolute URL
*
* @param string $path the parameter to be used to generate a valid URL
* @param array $args arguments
* @return string the generated absolute URL
*/
public function url($path, $args = [])
{
return Url::to(array_merge([$path], $args), true);
if ($args !== []) {
$path = array_merge([$path], $args);
}
return Url::to($path, true);
}
public function setProperty($object, $property, $value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment