Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
90c7a9c2
Commit
90c7a9c2
authored
Dec 26, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6464: `path` and `url` weren't resolving aliases
parent
ae2f4cfe
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
CHANGELOG.md
extensions/twig/CHANGELOG.md
+1
-1
Extension.php
extensions/twig/Extension.php
+22
-2
No files found.
extensions/twig/CHANGELOG.md
View file @
90c7a9c2
...
@@ -4,7 +4,7 @@ Yii Framework 2 twig extension Change Log
...
@@ -4,7 +4,7 @@ Yii Framework 2 twig extension Change Log
2.
0.2 under development
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
2.0.1 December 07, 2014
...
...
extensions/twig/Extension.php
View file @
90c7a9c2
...
@@ -177,14 +177,34 @@ class Extension extends \Twig_Extension
...
@@ -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
=
[])
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
=
[])
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
)
public
function
setProperty
(
$object
,
$property
,
$value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment