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
db212f05
Commit
db212f05
authored
Sep 09, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added $label parameter to ActiveField::label().
parent
e9a5b92d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
ActiveField.php
framework/yii/widgets/ActiveField.php
+6
-9
No files found.
framework/yii/widgets/ActiveField.php
View file @
db212f05
...
@@ -216,22 +216,19 @@ class ActiveField extends Component
...
@@ -216,22 +216,19 @@ class ActiveField extends Component
/**
/**
* Generates a label tag for [[attribute]].
* Generates a label tag for [[attribute]].
* The label text is the label associated with the attribute, obtained via [[Model::getAttributeLabel()]].
* @param string $label the label to use. If null, it will be generated via [[Model::getAttributeLabel()]].
* Note that this will NOT be [[Html::encode()|encoded]].
* @param array $options the tag options in terms of name-value pairs. It will be merged with [[labelOptions]].
* @param array $options the tag options in terms of name-value pairs. It will be merged with [[labelOptions]].
* The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded
* The options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded
* using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
* using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
* The following options are specially handled:
*
* - label: this specifies the label to be displayed. Note that this will NOT be [[encoded()]].
* If this is not set, [[Model::getAttributeLabel()]] will be called to get the label for display
* (after encoding).
*
* @return ActiveField the field object itself
* @return ActiveField the field object itself
*/
*/
public
function
label
(
$options
=
array
())
public
function
label
(
$
label
=
null
,
$
options
=
array
())
{
{
$options
=
array_merge
(
$this
->
labelOptions
,
$options
);
$options
=
array_merge
(
$this
->
labelOptions
,
$options
);
if
(
$label
!==
null
)
{
$options
[
'label'
]
=
$label
;
}
$this
->
parts
[
'{label}'
]
=
Html
::
activeLabel
(
$this
->
model
,
$this
->
attribute
,
$options
);
$this
->
parts
[
'{label}'
]
=
Html
::
activeLabel
(
$this
->
model
,
$this
->
attribute
,
$options
);
return
$this
;
return
$this
;
}
}
...
...
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