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
2bcc4418
Commit
2bcc4418
authored
May 27, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3597 from armab/patch-1
Improved array support for "data" attribute in renderTagAttributes()
parents
66477091
25c95045
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
BaseHtml.php
framework/helpers/BaseHtml.php
+7
-1
No files found.
framework/CHANGELOG.md
View file @
2bcc4418
...
...
@@ -60,6 +60,7 @@ Yii Framework 2 Change Log
-
Enh #3542: Removed requirement to specify
`extensions`
in application config (samdark)
-
Enh #3562: Adding rotateByCopy to yii
\l
og
\F
ileTarget (pawzar)
-
Enh #3574: Add integrity check support for SQLite (zeeke)
-
Enh #3597: Nested array support for HTML5 custom "data-
*
" attributes (armab)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
...
...
framework/helpers/BaseHtml.php
View file @
2bcc4418
...
...
@@ -1569,6 +1569,8 @@ class BaseHtml
* the array will be "expanded" and a list data attributes will be rendered. For example,
* if `'data' => ['id' => 1, 'name' => 'yii']`, then this will be rendered:
* `data-id="1" data-name="yii"`.
* Additionally `'data' => ['params' => ['id' => 1, 'name' => 'yii'], 'status' => 'ok']` will be rendered as:
* `data-params='{"id":1,"name":"yii"}' data-status="ok"`.
*
* @param array $attributes attributes to be rendered. The attribute values will be HTML-encoded using [[encode()]].
* @return string the rendering result. If the attributes are not empty, they will be rendered
...
...
@@ -1595,7 +1597,11 @@ class BaseHtml
}
}
elseif
(
is_array
(
$value
)
&&
$name
===
'data'
)
{
foreach
(
$value
as
$n
=>
$v
)
{
$html
.=
"
$name
-
$n
=
\"
"
.
static
::
encode
(
$v
)
.
'"'
;
if
(
is_array
(
$v
))
{
$html
.=
"
$name
-
$n
='"
.
Json
::
encode
(
$v
)
.
"'"
;
}
else
{
$html
.=
"
$name
-
$n
=
\"
"
.
static
::
encode
(
$v
)
.
'"'
;
}
}
}
elseif
(
$value
!==
null
)
{
$html
.=
"
$name
=
\"
"
.
static
::
encode
(
$value
)
.
'"'
;
...
...
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