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
544981a4
Commit
544981a4
authored
Nov 29, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6318: Made widgets more error-tolerant and user-friendly when certain option values are null
parent
83b0b3d4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
12 additions
and
11 deletions
+12
-11
Collapse.php
extensions/bootstrap/Collapse.php
+2
-2
Dropdown.php
extensions/bootstrap/Dropdown.php
+1
-1
Tabs.php
extensions/bootstrap/Tabs.php
+2
-2
Accordion.php
extensions/jui/Accordion.php
+2
-2
Selectable.php
extensions/jui/Selectable.php
+1
-1
Tabs.php
extensions/jui/Tabs.php
+2
-2
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Breadcrumbs.php
framework/widgets/Breadcrumbs.php
+1
-1
No files found.
extensions/bootstrap/Collapse.php
View file @
544981a4
...
...
@@ -94,7 +94,7 @@ class Collapse extends Widget
$items
=
[];
$index
=
0
;
foreach
(
$this
->
items
as
$item
)
{
if
(
!
isset
(
$item
[
'label'
]
))
{
if
(
!
array_key_exists
(
'label'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
}
$header
=
$item
[
'label'
];
...
...
@@ -116,7 +116,7 @@ class Collapse extends Widget
*/
public
function
renderItem
(
$header
,
$item
,
$index
)
{
if
(
isset
(
$item
[
'content'
]
))
{
if
(
array_key_exists
(
'content'
,
$item
))
{
$id
=
$this
->
options
[
'id'
]
.
'-collapse'
.
$index
;
$options
=
ArrayHelper
::
getValue
(
$item
,
'contentOptions'
,
[]);
$options
[
'id'
]
=
$id
;
...
...
extensions/bootstrap/Dropdown.php
View file @
544981a4
...
...
@@ -84,7 +84,7 @@ class Dropdown extends Widget
$lines
[]
=
$item
;
continue
;
}
if
(
!
isset
(
$item
[
'label'
]
))
{
if
(
!
array_key_exists
(
'label'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
}
$encodeLabel
=
isset
(
$item
[
'encode'
])
?
$item
[
'encode'
]
:
$this
->
encodeLabels
;
...
...
extensions/bootstrap/Tabs.php
View file @
544981a4
...
...
@@ -142,7 +142,7 @@ class Tabs extends Widget
}
foreach
(
$this
->
items
as
$n
=>
$item
)
{
if
(
!
isset
(
$item
[
'label'
]
))
{
if
(
!
array_key_exists
(
'label'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'label' option is required."
);
}
$encodeLabel
=
isset
(
$item
[
'encode'
])
?
$item
[
'encode'
]
:
$this
->
encodeLabels
;
...
...
@@ -216,7 +216,7 @@ class Tabs extends Widget
if
(
is_string
(
$item
))
{
continue
;
}
if
(
!
isset
(
$item
[
'content'
]
))
{
if
(
!
array_key_exists
(
'content'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'content' option is required."
);
}
...
...
extensions/jui/Accordion.php
View file @
544981a4
...
...
@@ -108,10 +108,10 @@ class Accordion extends Widget
{
$items
=
[];
foreach
(
$this
->
items
as
$item
)
{
if
(
!
isset
(
$item
[
'header'
]
))
{
if
(
!
array_key_exists
(
'header'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'header' option is required."
);
}
if
(
!
isset
(
$item
[
'content'
]
))
{
if
(
!
array_key_exists
(
'content'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'content' option is required."
);
}
$headerOptions
=
array_merge
(
$this
->
headerOptions
,
ArrayHelper
::
getValue
(
$item
,
'headerOptions'
,
[]));
...
...
extensions/jui/Selectable.php
View file @
544981a4
...
...
@@ -105,7 +105,7 @@ class Selectable extends Widget
$options
=
$this
->
itemOptions
;
$tag
=
ArrayHelper
::
remove
(
$options
,
'tag'
,
'li'
);
if
(
is_array
(
$item
))
{
if
(
!
isset
(
$item
[
'content'
]
))
{
if
(
!
array_key_exists
(
'content'
,
$item
))
{
throw
new
InvalidConfigException
(
"The 'content' option is required."
);
}
$options
=
array_merge
(
$options
,
ArrayHelper
::
getValue
(
$item
,
'options'
,
[]));
...
...
extensions/jui/Tabs.php
View file @
544981a4
...
...
@@ -128,8 +128,8 @@ class Tabs extends Widget
if
(
isset
(
$item
[
'url'
]))
{
$url
=
Url
::
to
(
$item
[
'url'
]);
}
else
{
if
(
!
isset
(
$item
[
'content'
]
))
{
throw
new
InvalidConfigException
(
"
T
he 'content' or 'url' option is required."
);
if
(
!
array_key_exists
(
'content'
,
$item
))
{
throw
new
InvalidConfigException
(
"
Either t
he 'content' or 'url' option is required."
);
}
$options
=
array_merge
(
$this
->
itemOptions
,
ArrayHelper
::
getValue
(
$item
,
'options'
,
[]));
$tag
=
ArrayHelper
::
remove
(
$options
,
'tag'
,
'div'
);
...
...
framework/CHANGELOG.md
View file @
544981a4
...
...
@@ -73,6 +73,7 @@ Yii Framework 2 Change Log
-
Enh #5983: Added
`Inflector::sentence()`
(pana1990, qiangxue)
-
Enh #6113: Improved debugger configuration and request UI (schmunk42)
-
Enh #6207: Added support for truncating HTML strings using
`StringHelper::truncate()`
and
`StringHelper::truncateWords()`
(Alex-Code)
-
Enh #6318: Made widgets more error-tolerant and user-friendly when certain option values are null (qiangxue)
-
Enh:
`Console::confirm()`
now uses
`Console::stdout()`
instead of
`echo`
to be consistent with all other functions (cebe)
-
Enh:
`yii\rbac\DbManager`
migration now uses database component specified in component settings instead of always using default
`db`
(samdark)
-
Enh: Added
`yii\base\Controller::renderContent()`
(qiangxue)
...
...
framework/widgets/Breadcrumbs.php
View file @
544981a4
...
...
@@ -150,7 +150,7 @@ class Breadcrumbs extends Widget
*/
protected
function
renderItem
(
$link
,
$template
)
{
if
(
isset
(
$link
[
'label'
]
))
{
if
(
array_key_exists
(
'label'
,
$link
))
{
$label
=
$this
->
encodeLabels
?
Html
::
encode
(
$link
[
'label'
])
:
$link
[
'label'
];
}
else
{
throw
new
InvalidConfigException
(
'The "label" element is required for each link.'
);
...
...
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