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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
c2b47d81
Commit
c2b47d81
authored
Jun 08, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #516 from m-o-g/master
Multilevel Nav items
parents
cf1e12ad
95b1636a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
Nav.php
framework/yii/bootstrap/Nav.php
+15
-9
No files found.
framework/yii/bootstrap/Nav.php
View file @
c2b47d81
...
...
@@ -27,13 +27,19 @@ use yii\helpers\Html;
* ),
* array(
* 'label' => 'Dropdown',
* '
dropdown
' => array(
* '
items
' => array(
* array(
* 'label' => 'DropdownA',
* 'label' => '
Level 1 -
DropdownA',
* 'url' => '#',
* 'items' => array(
* array(
* 'label' => 'Level 2 -DropdownA',
* 'url' => '#',
* ),
* ),
* ),
* array(
* 'label' => 'DropdownB',
* 'label' => '
Level 1 -
DropdownB',
* 'url' => '#',
* ),
* ),
...
...
@@ -114,7 +120,7 @@ class Nav extends Widget
}
$label
=
$this
->
encodeLabels
?
Html
::
encode
(
$item
[
'label'
])
:
$item
[
'label'
];
$options
=
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
());
$
dropdown
=
ArrayHelper
::
getValue
(
$item
,
'dropdown
'
);
$
items
=
ArrayHelper
::
getValue
(
$item
,
'items
'
);
$url
=
Html
::
url
(
ArrayHelper
::
getValue
(
$item
,
'url'
,
'#'
));
$linkOptions
=
ArrayHelper
::
getValue
(
$item
,
'linkOptions'
,
array
());
...
...
@@ -122,19 +128,19 @@ class Nav extends Widget
$this
->
addCssClass
(
$options
,
'active'
);
}
if
(
$
dropdown
!==
null
)
{
if
(
$
items
!==
null
)
{
$linkOptions
[
'data-toggle'
]
=
'dropdown'
;
$this
->
addCssClass
(
$options
,
'dropdown'
);
$this
->
addCssClass
(
$urlOptions
,
'dropdown-toggle'
);
$label
.=
' '
.
Html
::
tag
(
'b'
,
''
,
array
(
'class'
=>
'caret'
));
if
(
is_array
(
$
dropdown
))
{
$
dropdown
=
Dropdown
::
widget
(
array
(
'items'
=>
$
dropdown
,
if
(
is_array
(
$
items
))
{
$
items
=
Dropdown
::
widget
(
array
(
'items'
=>
$
items
,
'clientOptions'
=>
false
,
));
}
}
return
Html
::
tag
(
'li'
,
Html
::
a
(
$label
,
$url
,
$linkOptions
)
.
$
dropdown
,
$options
);
return
Html
::
tag
(
'li'
,
Html
::
a
(
$label
,
$url
,
$linkOptions
)
.
$
items
,
$options
);
}
}
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