Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
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
夏彬
yii2bootstrap
Commits
36c2c5ac
Commit
36c2c5ac
authored
Feb 20, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #2425: Tabs widget now selects first tab if no active tab is specified
parent
6cd480ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
Tabs.php
Tabs.php
+18
-0
No files found.
CHANGELOG.md
View file @
36c2c5ac
...
...
@@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Enh #1562: Added
`yii\bootstrap\Tabs::linkOptions`
(kartik-v)
-
Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
-
Enh #1881: Improved
`yii\bootstrap\NavBar`
with
`containerOptions`
,
`innerContainerOptions`
and
`renderInnerContainer`
(creocoder)
-
Enh #2425: Tabs widget now selects first tab if no active tab is specified (samdark)
-
Chg #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard)
-
Chg #1820: Update Progress to use bootstrap 3 markup (samdark)
...
...
Tabs.php
View file @
36c2c5ac
...
...
@@ -124,6 +124,11 @@ class Tabs extends Widget
{
$headers
=
[];
$panes
=
[];
if
(
!
$this
->
hasActiveTab
()
&&
!
empty
(
$this
->
items
))
{
$this
->
items
[
0
][
'active'
]
=
true
;
}
foreach
(
$this
->
items
as
$n
=>
$item
)
{
if
(
!
isset
(
$item
[
'label'
]))
{
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
...
...
@@ -167,6 +172,19 @@ class Tabs extends Widget
.
Html
::
tag
(
'div'
,
implode
(
"
\n
"
,
$panes
),
[
'class'
=>
'tab-content'
]);
}
/**
* @return boolean if there's active tab defined
*/
protected
function
hasActiveTab
()
{
foreach
(
$this
->
items
as
$item
)
{
if
(
isset
(
$item
[
'active'
])
&&
$item
[
'active'
]
===
true
)
{
return
true
;
}
}
return
false
;
}
/**
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
* configure `panes` accordingly.
...
...
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