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
06de50da
Commit
06de50da
authored
Jun 24, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4028 from umneeq/yii-widgets-menu-enh
Added ability to `yii\widgets\Menu` to encode each item's label separately
parents
cc9c57e1
56e4f7ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Menu.php
framework/widgets/Menu.php
+4
-1
No files found.
framework/CHANGELOG.md
View file @
06de50da
...
@@ -114,6 +114,7 @@ Yii Framework 2 Change Log
...
@@ -114,6 +114,7 @@ Yii Framework 2 Change Log
-
Enh: Added support for array attributes in
`in`
validator (creocoder)
-
Enh: Added support for array attributes in
`in`
validator (creocoder)
-
Enh: Improved
`yii\helpers\Inflector::slug`
to support more cases for Russian, Hebrew and special characters (samdark)
-
Enh: Improved
`yii\helpers\Inflector::slug`
to support more cases for Russian, Hebrew and special characters (samdark)
-
Enh #3926:
`yii\widgets\Breadcrumbs::$links`
. Allows individual link to have its own
`template`
(creocoder, umneeq)
-
Enh #3926:
`yii\widgets\Breadcrumbs::$links`
. Allows individual link to have its own
`template`
(creocoder, umneeq)
-
Enh #4028: Added ability to
`yii\widgets\Menu`
to encode each item's label separately (creocoder, umneeq)
-
Chg #2898:
`yii\console\controllers\AssetController`
is now using hashes instead of timestamps (samdark)
-
Chg #2898:
`yii\console\controllers\AssetController`
is now using hashes instead of timestamps (samdark)
-
Chg #2913: RBAC
`DbManager`
is now initialized via migration (samdark)
-
Chg #2913: RBAC
`DbManager`
is now initialized via migration (samdark)
-
Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
-
Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
...
...
framework/widgets/Menu.php
View file @
06de50da
...
@@ -53,6 +53,8 @@ class Menu extends Widget
...
@@ -53,6 +53,8 @@ class Menu extends Widget
*
*
* - label: string, optional, specifies the menu item label. When [[encodeLabels]] is true, the label
* - label: string, optional, specifies the menu item label. When [[encodeLabels]] is true, the label
* will be HTML-encoded. If the label is not specified, an empty string will be used.
* will be HTML-encoded. If the label is not specified, an empty string will be used.
* - encode: boolean, optional, whether this item`s label should be HTML-encoded. This param will override
* global [[encodeLabels]] param.
* - url: string or array, optional, specifies the URL of the menu item. It will be processed by [[Url::to]].
* - url: string or array, optional, specifies the URL of the menu item. It will be processed by [[Url::to]].
* When this is set, the actual menu item content will be generated using [[linkTemplate]];
* When this is set, the actual menu item content will be generated using [[linkTemplate]];
* otherwise, [[labelTemplate]] will be used.
* otherwise, [[labelTemplate]] will be used.
...
@@ -255,7 +257,8 @@ class Menu extends Widget
...
@@ -255,7 +257,8 @@ class Menu extends Widget
if
(
!
isset
(
$item
[
'label'
]))
{
if
(
!
isset
(
$item
[
'label'
]))
{
$item
[
'label'
]
=
''
;
$item
[
'label'
]
=
''
;
}
}
$items
[
$i
][
'label'
]
=
$this
->
encodeLabels
?
Html
::
encode
(
$item
[
'label'
])
:
$item
[
'label'
];
$encodeLabel
=
$this
->
encodeLabels
||
isset
(
$item
[
'encode'
])
&&
$item
[
'encode'
]
===
true
;
$items
[
$i
][
'label'
]
=
$encodeLabel
?
Html
::
encode
(
$item
[
'label'
])
:
$item
[
'label'
];
$hasActiveChild
=
false
;
$hasActiveChild
=
false
;
if
(
isset
(
$item
[
'items'
]))
{
if
(
isset
(
$item
[
'items'
]))
{
$items
[
$i
][
'items'
]
=
$this
->
normalizeItems
(
$item
[
'items'
],
$hasActiveChild
);
$items
[
$i
][
'items'
]
=
$this
->
normalizeItems
(
$item
[
'items'
],
$hasActiveChild
);
...
...
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