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
3dd3914a
Commit
3dd3914a
authored
Jan 24, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #2144: `Html` helper now supports rendering "data" attributes
parent
a19dd39e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
CHANGELOG.md
framework/CHANGELOG.md
+2
-1
BaseHtml.php
framework/helpers/BaseHtml.php
+13
-1
No files found.
framework/CHANGELOG.md
View file @
3dd3914a
...
...
@@ -71,6 +71,7 @@ Yii Framework 2 Change Log
-
Enh #1706: Added support for registering a single JS/CSS file with dependency (qiangxue)
-
Enh #1773: keyPrefix property of Cache is not restricted to alnum characters anymore, however it is still recommended (cebe)
-
Enh #1809: Added support for building "EXISTS" and "NOT EXISTS" query conditions (abdrasulov)
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Enh #1852: ActiveRecord::tableName() now returns table name using DbConnection::tablePrefix (creocoder)
-
Enh #1894: The path aliases
`@webroot`
and
`@web`
are now available right after the application is initialized (qiangxue)
-
Enh #1921: Grid view ActionColumn now allow to name buttons like
`{controller/action}`
(creocoder)
...
...
@@ -88,6 +89,7 @@ Yii Framework 2 Change Log
-
Enh #2103: Renamed AccessDeniedHttpException to ForbiddenHttpException, added new commonly used HTTP exception classes (danschmidt5189)
-
Enh #2124: Added support for UNION ALL queries (Ivan Pomortsev, iworker)
-
Enh #2132: Allow url of CSS and JS files registered in yii
\w
eb
\V
iew to be url alias (cebe)
-
Enh #2144:
`Html`
helper now supports rendering "data" attributes (qiangxue)
-
Enh: Added
`favicon.ico`
and
`robots.txt`
to default application templates (samdark)
-
Enh: Added
`Widget::autoIdPrefix`
to support prefixing automatically generated widget IDs (qiangxue)
-
Enh: Support for file aliases in console command 'message' (omnilight)
...
...
@@ -97,7 +99,6 @@ Yii Framework 2 Change Log
-
Enh: Better exception message when class cannot be loaded (samdark)
-
Enh:
`init`
of advanced application now allows to specify answer for overwriting files via
`init --overwrite=n`
(samdark)
-
Enh: Added
`TableSchema::fullName`
property (qiangxue)
-
Enh #1839: Added support for getting file extension and basename from uploaded file (anfrantic)
-
Enh: yii
\c
odeception
\T
estCase now supports loading and using fixtures via Yii fixture framework (qiangxue)
-
Enh: Added support to parse json request data to Request::getRestParams() (cebe)
-
Enh: Added ability to get incoming headers (dizews)
...
...
framework/helpers/BaseHtml.php
View file @
3dd3914a
...
...
@@ -1419,9 +1419,17 @@ class BaseHtml
/**
* Renders the HTML tag attributes.
*
* Attributes whose values are of boolean type will be treated as
* [boolean attributes](http://www.w3.org/TR/html5/infrastructure.html#boolean-attributes).
* And attributes whose values are null will not be rendered.
*
* Attributes whose values are null will not be rendered.
*
* The "data" attribute is specially handled when it is receiving an array value. In this case,
* 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"`.
*
* @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
* into a string with a leading white space (so that it can be directly appended to the tag name
...
...
@@ -1445,6 +1453,10 @@ class BaseHtml
if
(
$value
)
{
$html
.=
"
$name
"
;
}
}
elseif
(
is_array
(
$value
)
&&
$name
===
'data'
)
{
foreach
(
$value
as
$n
=>
$v
)
{
$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