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
389d9e2f
Commit
389d9e2f
authored
Jan 04, 2015
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add hint about custom element id and selectors property
to Active Field fixes #6734
parent
b0b94ad5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
ActiveField.php
framework/widgets/ActiveField.php
+39
-0
No files found.
framework/widgets/ActiveField.php
View file @
389d9e2f
...
@@ -43,6 +43,8 @@ class ActiveField extends Component
...
@@ -43,6 +43,8 @@ class ActiveField extends Component
*
*
* - tag: the tag name of the container element. Defaults to "div".
* - tag: the tag name of the container element. Defaults to "div".
*
*
* If you set a custom `id` for the container element, you may need to adjust the [[$selectors]] accordingly.
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
*/
public
$options
=
[
'class'
=>
'form-group'
];
public
$options
=
[
'class'
=>
'form-group'
];
...
@@ -54,6 +56,9 @@ class ActiveField extends Component
...
@@ -54,6 +56,9 @@ class ActiveField extends Component
/**
/**
* @var array the default options for the input tags. The parameter passed to individual input methods
* @var array the default options for the input tags. The parameter passed to individual input methods
* (e.g. [[textInput()]]) will be merged with this property when rendering the input tag.
* (e.g. [[textInput()]]) will be merged with this property when rendering the input tag.
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
*/
public
$inputOptions
=
[
'class'
=>
'form-control'
];
public
$inputOptions
=
[
'class'
=>
'form-control'
];
...
@@ -65,6 +70,8 @@ class ActiveField extends Component
...
@@ -65,6 +70,8 @@ class ActiveField extends Component
* - tag: the tag name of the container element. Defaults to "div".
* - tag: the tag name of the container element. Defaults to "div".
* - encode: whether to encode the error output. Defaults to true.
* - encode: whether to encode the error output. Defaults to true.
*
*
* If you set a custom `id` for the error element, you may need to adjust the [[$selectors]] accordingly.
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
*/
public
$errorOptions
=
[
'class'
=>
'help-block'
];
public
$errorOptions
=
[
'class'
=>
'help-block'
];
...
@@ -271,6 +278,8 @@ class ActiveField extends Component
...
@@ -271,6 +278,8 @@ class ActiveField extends Component
*
*
* If this parameter is false, no error tag will be rendered.
* If this parameter is false, no error tag will be rendered.
*
*
* If you set a custom `id` for the error element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
error
(
$options
=
[])
public
function
error
(
$options
=
[])
...
@@ -311,6 +320,9 @@ class ActiveField extends Component
...
@@ -311,6 +320,9 @@ class ActiveField extends Component
* @param string $type the input type (e.g. 'text', 'password')
* @param string $type the input type (e.g. 'text', 'password')
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
input
(
$type
,
$options
=
[])
public
function
input
(
$type
,
$options
=
[])
...
@@ -328,6 +340,9 @@ class ActiveField extends Component
...
@@ -328,6 +340,9 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
textInput
(
$options
=
[])
public
function
textInput
(
$options
=
[])
...
@@ -350,6 +365,9 @@ class ActiveField extends Component
...
@@ -350,6 +365,9 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
hiddenInput
(
$options
=
[])
public
function
hiddenInput
(
$options
=
[])
...
@@ -367,6 +385,9 @@ class ActiveField extends Component
...
@@ -367,6 +385,9 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
passwordInput
(
$options
=
[])
public
function
passwordInput
(
$options
=
[])
...
@@ -384,6 +405,9 @@ class ActiveField extends Component
...
@@ -384,6 +405,9 @@ class ActiveField extends Component
* unless they are explicitly specified in `$options`.
* unless they are explicitly specified in `$options`.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
fileInput
(
$options
=
[])
public
function
fileInput
(
$options
=
[])
...
@@ -403,6 +427,9 @@ class ActiveField extends Component
...
@@ -403,6 +427,9 @@ class ActiveField extends Component
* The model attribute value will be used as the content in the textarea.
* The model attribute value will be used as the content in the textarea.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
* the attributes of the resulting tag. The values will be HTML-encoded using [[Html::encode()]].
*
* If you set a custom `id` for the textarea element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
textarea
(
$options
=
[])
public
function
textarea
(
$options
=
[])
...
@@ -430,6 +457,9 @@ class ActiveField extends Component
...
@@ -430,6 +457,9 @@ class ActiveField extends Component
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of 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.
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @param boolean $enclosedByLabel whether to enclose the radio within the label.
* @param boolean $enclosedByLabel whether to enclose the radio within the label.
* If true, the method will still use [[template]] to layout the checkbox and the error message
* If true, the method will still use [[template]] to layout the checkbox and the error message
* except that the radio is enclosed by the label tag.
* except that the radio is enclosed by the label tag.
...
@@ -471,6 +501,9 @@ class ActiveField extends Component
...
@@ -471,6 +501,9 @@ class ActiveField extends Component
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of 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.
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @param boolean $enclosedByLabel whether to enclose the checkbox within the label.
* @param boolean $enclosedByLabel whether to enclose the checkbox within the label.
* If true, the method will still use [[template]] to layout the checkbox and the error message
* If true, the method will still use [[template]] to layout the checkbox and the error message
* except that the checkbox is enclosed by the label tag.
* except that the checkbox is enclosed by the label tag.
...
@@ -527,6 +560,8 @@ class ActiveField extends Component
...
@@ -527,6 +560,8 @@ class ActiveField extends Component
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of 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.
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
dropDownList
(
$items
,
$options
=
[])
public
function
dropDownList
(
$items
,
$options
=
[])
...
@@ -571,6 +606,8 @@ class ActiveField extends Component
...
@@ -571,6 +606,8 @@ class ActiveField extends Component
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of 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.
* be HTML-encoded using [[Html::encode()]]. If a value is null, the corresponding attribute will not be rendered.
*
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @return static the field object itself
* @return static the field object itself
*/
*/
public
function
listBox
(
$items
,
$options
=
[])
public
function
listBox
(
$items
,
$options
=
[])
...
@@ -665,6 +702,8 @@ class ActiveField extends Component
...
@@ -665,6 +702,8 @@ class ActiveField extends Component
* ]);
* ]);
* ```
* ```
*
*
* If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
*
* @param string $class the widget class name
* @param string $class the widget class name
* @param array $config name-value pairs that will be used to initialize the widget
* @param array $config name-value pairs that will be used to initialize the widget
* @return static the field object itself
* @return static the field object itself
...
...
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