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
46ca87a4
Commit
46ca87a4
authored
Feb 21, 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
8f491f28
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
CHANGELOG.md
extensions/bootstrap/CHANGELOG.md
+1
-0
Tabs.php
extensions/bootstrap/Tabs.php
+18
-0
No files found.
extensions/bootstrap/CHANGELOG.md
View file @
46ca87a4
...
@@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log
...
@@ -11,6 +11,7 @@ Yii Framework 2 bootstrap extension Change Log
-
Enh #1562: Added
`yii\bootstrap\Tabs::linkOptions`
(kartik-v)
-
Enh #1562: Added
`yii\bootstrap\Tabs::linkOptions`
(kartik-v)
-
Enh #1601: Added support for tagName and encodeLabel parameters in ButtonDropdown (omnilight)
-
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 #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 #1459: Update Collapse to use bootstrap 3 classes (tonydspaniard)
-
Chg #1820: Update Progress to use bootstrap 3 markup (samdark)
-
Chg #1820: Update Progress to use bootstrap 3 markup (samdark)
...
...
extensions/bootstrap/Tabs.php
View file @
46ca87a4
...
@@ -124,6 +124,11 @@ class Tabs extends Widget
...
@@ -124,6 +124,11 @@ class Tabs extends Widget
{
{
$headers
=
[];
$headers
=
[];
$panes
=
[];
$panes
=
[];
if
(
!
$this
->
hasActiveTab
()
&&
!
empty
(
$this
->
items
))
{
$this
->
items
[
0
][
'active'
]
=
true
;
}
foreach
(
$this
->
items
as
$n
=>
$item
)
{
foreach
(
$this
->
items
as
$n
=>
$item
)
{
if
(
!
isset
(
$item
[
'label'
]))
{
if
(
!
isset
(
$item
[
'label'
]))
{
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
...
@@ -168,6 +173,19 @@ class Tabs extends Widget
...
@@ -168,6 +173,19 @@ class Tabs extends Widget
}
}
/**
/**
* @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
* Normalizes dropdown item options by removing tab specific keys `content` and `contentOptions`, and also
* configure `panes` accordingly.
* configure `panes` accordingly.
* @param array $items the dropdown items configuration.
* @param array $items the dropdown items configuration.
...
...
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