PHP 클래스 yii\helpers\BaseHtml

Do not use BaseHtml. Use [[Html]] instead.
부터: 2.0
저자: Qiang Xue ([email protected])
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$attributeOrder the preferred order of attributes in a tag. This mainly affects the order of the attributes that are rendered by BaseHtml::renderTagAttributes.
$dataAttributes list of tag attributes that should be specially handled when their values are of array type. In particular, if the value of the data attribute is ['name' => 'xyz', 'age' => 13], two attributes will be generated instead of one: data-name="xyz" data-age="13".
$voidElements list of void elements (element name => 1)

공개 메소드들

메소드 설명
a ( string $text, array | string | null $url = null, array $options = [] ) : string Generates a hyperlink tag.
activeCheckbox ( Model $model, string $attribute, array $options = [] ) : string Generates a checkbox tag together with a label for the given model attribute.
activeCheckboxList ( Model $model, string $attribute, array $items, array $options = [] ) : string Generates a list of checkboxes.
activeDropDownList ( Model $model, string $attribute, array $items, array $options = [] ) : string Generates a drop-down list for the given model attribute.
activeFileInput ( Model $model, string $attribute, array $options = [] ) : string Generates a file input tag for the given model attribute.
activeHiddenInput ( Model $model, string $attribute, array $options = [] ) : string Generates a hidden input tag for the given model attribute.
activeHint ( Model $model, string $attribute, array $options = [] ) : string Generates a hint tag for the given model attribute.
activeInput ( string $type, Model $model, string $attribute, array $options = [] ) : string Generates an input tag for the given model attribute.
activeLabel ( Model $model, string $attribute, array $options = [] ) : string Generates a label tag for the given model attribute.
activeListBox ( Model $model, string $attribute, array $items, array $options = [] ) : string Generates a list box.
activePasswordInput ( Model $model, string $attribute, array $options = [] ) : string Generates a password input tag for the given model attribute.
activeRadio ( Model $model, string $attribute, array $options = [] ) : string Generates a radio button tag together with a label for the given model attribute.
activeRadioList ( Model $model, string $attribute, array $items, array $options = [] ) : string Generates a list of radio buttons.
activeTextInput ( Model $model, string $attribute, array $options = [] ) : string Generates a text input tag for the given model attribute.
activeTextarea ( Model $model, string $attribute, array $options = [] ) : string Generates a textarea tag for the given model attribute.
addCssClass ( array &$options, string | array $class ) Adds a CSS class (or several classes) to the specified options.
addCssStyle ( array &$options, string | array $style, boolean $overwrite = true ) Adds the specified CSS style to the HTML options.
beginForm ( array | string $action = '', string $method = 'post', array $options = [] ) : string Generates a form start tag.
beginTag ( string | boolean | null $name, array $options = [] ) : string Generates a start tag.
button ( string $content = 'Button', array $options = [] ) : string Generates a button tag.
buttonInput ( string $label = 'Button', array $options = [] ) : string Generates an input button.
checkbox ( string $name, boolean $checked = false, array $options = [] ) : string Generates a checkbox input.
checkboxList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string Generates a list of checkboxes.
csrfMetaTags ( ) : string Generates the meta tags containing CSRF token information.
cssFile ( array | string $url, array $options = [] ) : string Generates a link tag that refers to an external CSS file.
cssStyleFromArray ( array $style ) : string Converts a CSS style array into a string representation.
cssStyleToArray ( string $style ) : array Converts a CSS style string into an array representation.
decode ( string $content ) : string Decodes special HTML entities back to the corresponding characters.
dropDownList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string Generates a drop-down list.
encode ( string $content, boolean $doubleEncode = true ) : string Encodes special characters into HTML entities.
endForm ( ) : string Generates a form end tag.
endTag ( string | boolean | null $name ) : string Generates an end tag.
error ( Model $model, string $attribute, array $options = [] ) : string Generates a tag that contains the first validation error of the specified model attribute.
errorSummary ( Model | Model[] $models, array $options = [] ) : string Generates a summary of the validation errors.
escapeJsRegularExpression ( string $regexp ) : string Escapes regular expression to use in JavaScript
fileInput ( string $name, string $value = null, array $options = [] ) : string Generates a file input field.
getAttributeName ( string $attribute ) : string Returns the real attribute name from the given attribute expression.
getAttributeValue ( Model $model, string $attribute ) : string | array Returns the value of the specified attribute name or expression.
getInputId ( Model $model, string $attribute ) : string Generates an appropriate input ID for the specified attribute name or expression.
getInputName ( Model $model, string $attribute ) : string Generates an appropriate input name for the specified attribute name or expression.
hiddenInput ( string $name, string $value = null, array $options = [] ) : string Generates a hidden input field.
img ( array | string $src, array $options = [] ) : string Generates an image tag.
input ( string $type, string $name = null, string $value = null, array $options = [] ) : string Generates an input type of the given type.
jsFile ( string $url, array $options = [] ) : string Generates a script tag that refers to an external JavaScript file.
label ( string $content, string $for = null, array $options = [] ) : string Generates a label tag.
listBox ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string Generates a list box.
mailto ( string $text, string $email = null, array $options = [] ) : string Generates a mailto hyperlink.
ol ( array | Traversable $items, array $options = [] ) : string Generates an ordered list.
passwordInput ( string $name, string $value = null, array $options = [] ) : string Generates a password input field.
radio ( string $name, boolean $checked = false, array $options = [] ) : string Generates a radio button input.
radioList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string Generates a list of radio buttons.
removeCssClass ( array &$options, string | array $class ) Removes a CSS class from the specified options.
removeCssStyle ( array &$options, string | array $properties ) Removes the specified CSS style from the HTML options.
renderSelectOptions ( string | array | null $selection, array $items, array &$tagOptions = [] ) : string Renders the option tags that can be used by BaseHtml::dropDownList and BaseHtml::listBox.
renderTagAttributes ( array $attributes ) : string Renders the HTML tag attributes.
resetButton ( string $content = 'Reset', array $options = [] ) : string Generates a reset button tag.
resetInput ( string $label = 'Reset', array $options = [] ) : string Generates a reset input button.
script ( string $content, array $options = [] ) : string Generates a script tag.
style ( string $content, array $options = [] ) : string Generates a style tag.
submitButton ( string $content = 'Submit', array $options = [] ) : string Generates a submit button tag.
submitInput ( string $label = 'Submit', array $options = [] ) : string Generates a submit input button.
tag ( string | boolean | null $name, string $content = '', array $options = [] ) : string Generates a complete HTML tag.
textInput ( string $name, string $value = null, array $options = [] ) : string Generates a text input field.
textarea ( string $name, string $value = '', array $options = [] ) : string Generates a text area input.
ul ( array | Traversable $items, array $options = [] ) : string Generates an unordered list.

보호된 메소드들

메소드 설명
activeBooleanInput ( string $type, Model $model, string $attribute, array $options = [] ) : string Generates a boolean input This method is mainly called by BaseHtml::activeCheckbox and BaseHtml::activeRadio.
activeListInput ( string $type, Model $model, string $attribute, array $items, array $options = [] ) : string Generates a list of input fields.
booleanInput ( string $type, string $name, boolean $checked = false, array $options = [] ) : string Generates a boolean input.

비공개 메소드들

메소드 설명
mergeCssClasses ( array $existingClasses, array $additionalClasses ) : array Merges already existing CSS classes with new one.
normalizeMaxLength ( Model $model, string $attribute, array &$options ) If maxlength option is set true and the model attribute is validated by a string validator, the maxlength option will take the value of [[\yii\validators\StringValidator::max]].
wrapIntoCondition ( string $content, string $condition ) : string Wraps given content into conditional comments for IE, e.g., lt IE 9.

메소드 상세

a() 공개 정적인 메소드

Generates a hyperlink tag.
또한 보기: yii\helpers\Url::to()
public static a ( string $text, array | string | null $url = null, array $options = [] ) : string
$text string link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$url array | string | null the URL for the hyperlink tag. This parameter will be processed by [[Url::to()]] and will be used for the "href" attribute of the tag. If this parameter is null, the "href" attribute will not be generated. If you want to use an absolute url you can call [[Url::to()]] yourself, before passing the URL to this method, like this: ```php Html::a('link text', Url::to($url, true)) ```
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated hyperlink

activeBooleanInput() 보호된 정적인 메소드

Generates a boolean input This method is mainly called by BaseHtml::activeCheckbox and BaseHtml::activeRadio.
부터: 2.0.9
protected static activeBooleanInput ( string $type, Model $model, string $attribute, array $options = [] ) : string
$type string the input type. This can be either `radio` or `checkbox`.
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array the tag options in terms of name-value pairs. See [[booleanInput()]] for details about accepted attributes.
리턴 string the generated input element

activeCheckbox() 공개 정적인 메소드

This method will generate the "checked" tag attribute according to the model attribute value.
public static activeCheckbox ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array the tag options in terms of name-value pairs. See [[booleanInput()]] for details about accepted attributes.
리턴 string the generated checkbox tag

activeCheckboxList() 공개 정적인 메소드

A checkbox list allows multiple selection, like BaseHtml::listBox. As a result, the corresponding submitted value is an array. The selection of the checkbox list is taken from the value of the model attribute.
public static activeCheckboxList ( Model $model, string $attribute, array $items, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the data item used to generate the checkboxes. The array keys are the checkbox values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will.
$options array options (name => config) for the checkbox list container tag. The following options are specially handled: - tag: string|false, the tag name of the container element. False to render checkbox without container. See also [[tag()]]. - unselect: string, the value that should be submitted when none of the checkboxes is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if `item` option is set. - separator: string, the HTML code that separates items. - itemOptions: array, the options for generating the checkbox tag using [[checkbox()]]. - item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ```php function ($index, $label, $name, $checked, $value) ``` where $index is the zero-based index of the checkbox in the whole list; $label is the label for the checkbox; and $name, $value and $checked represent the name, value and the checked status of the checkbox input. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated checkbox list

activeDropDownList() 공개 정적인 메소드

The selection of the drop-down list is taken from the value of the model attribute.
public static activeDropDownList ( Model $model, string $attribute, array $items, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[\yii\helpers\ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: ```php ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], ``` - options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, ```php [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]; ``` - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character. Defaults to false. - encode: bool, whether to encode option prompt and option value characters. Defaults to `true`. This option is available since 2.0.3. The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated drop-down list tag

activeFileInput() 공개 정적인 메소드

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activeFileInput ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated input tag

activeHiddenInput() 공개 정적인 메소드

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activeHiddenInput ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated input tag

activeHint() 공개 정적인 메소드

The hint text is the hint associated with the attribute, obtained via [[Model::getAttributeHint()]]. If no hint content can be obtained, method will return an empty string.
부터: 2.0.4
public static activeHint ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. The following options are specially handled: - hint: this specifies the hint to be displayed. Note that this will NOT be [[encode()|encoded]]. If this is not set, [[Model::getAttributeHint()]] will be called to get the hint for display (without encoding). See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated hint tag

activeInput() 공개 정적인 메소드

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activeInput ( string $type, Model $model, string $attribute, array $options = [] ) : string
$type string the input type (e.g. 'text', 'password')
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated input tag

activeLabel() 공개 정적인 메소드

The label text is the label associated with the attribute, obtained via [[Model::getAttributeLabel()]].
public static activeLabel ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[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 [[encode()|encoded]]. If this is not set, [[Model::getAttributeLabel()]] will be called to get the label for display (after encoding). See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated label tag

activeListBox() 공개 정적인 메소드

The selection of the list box is taken from the value of the model attribute.
public static activeListBox ( Model $model, string $attribute, array $items, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[\yii\helpers\ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: ```php ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], ``` - options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, ```php [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]; ``` - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. - unselect: string, the value that will be submitted when no option is selected. When this attribute is set, a hidden field will be generated so that if no option is selected in multiple mode, we can still obtain the posted unselect value. - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character. Defaults to false. - encode: bool, whether to encode option prompt and option value characters. Defaults to `true`. This option is available since 2.0.3. The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated list box tag

activeListInput() 보호된 정적인 메소드

protected static activeListInput ( string $type, Model $model, string $attribute, array $items, array $options = [] ) : string
$type string the input type. This can be 'listBox', 'radioList', or 'checkBoxList'.
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the data item used to generate the input fields. The array keys are the input values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will.
$options array options (name => config) for the input list. The supported special options depend on the input type specified by `$type`.
리턴 string the generated input list

activePasswordInput() 공개 정적인 메소드

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activePasswordInput ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered. The following special options are recognized: - maxlength: integer|boolean, when `maxlength` is set true and the model attribute is validated by a string validator, the `maxlength` option will take the value of [[\yii\validators\StringValidator::max]]. This option is available since version 2.0.6.
리턴 string the generated input tag

activeRadio() 공개 정적인 메소드

This method will generate the "checked" tag attribute according to the model attribute value.
public static activeRadio ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array the tag options in terms of name-value pairs. See [[booleanInput()]] for details about accepted attributes.
리턴 string the generated radio button tag

activeRadioList() 공개 정적인 메소드

A radio button list is like a checkbox list, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute.
public static activeRadioList ( Model $model, string $attribute, array $items, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$items array the data item used to generate the radio buttons. The array keys are the radio values, and the array values are the corresponding labels. Note that the labels will NOT be HTML-encoded, while the values will.
$options array options (name => config) for the radio button list container tag. The following options are specially handled: - tag: string|false, the tag name of the container element. False to render radio button without container. See also [[tag()]]. - unselect: string, the value that should be submitted when none of the radio buttons is selected. You may set this option to be null to prevent default value submission. If this option is not set, an empty string will be submitted. - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if `item` option is set. - separator: string, the HTML code that separates items. - itemOptions: array, the options for generating the radio button tag using [[radio()]]. - item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ```php function ($index, $label, $name, $checked, $value) ``` where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio button; and $name, $value and $checked represent the name, value and the checked status of the radio button input. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated radio button list

activeTextInput() 공개 정적인 메소드

This method will generate the "name" and "value" tag attributes automatically for the model attribute unless they are explicitly specified in $options.
public static activeTextInput ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered. The following special options are recognized: - maxlength: integer|boolean, when `maxlength` is set true and the model attribute is validated by a string validator, the `maxlength` option will take the value of [[\yii\validators\StringValidator::max]]. This is available since version 2.0.3.
리턴 string the generated input tag

activeTextarea() 공개 정적인 메소드

The model attribute value will be used as the content in the textarea.
public static activeTextarea ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array 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 [[encode()]]. See [[renderTagAttributes()]] for details on how attributes are being rendered. The following special options are recognized: - maxlength: integer|boolean, when `maxlength` is set true and the model attribute is validated by a string validator, the `maxlength` option will take the value of [[\yii\validators\StringValidator::max]]. This option is available since version 2.0.6.
리턴 string the generated textarea tag

addCssClass() 공개 정적인 메소드

If the CSS class is already in the options, it will not be added again. If class specification at given options is an array, and some class placed there with the named (string) key, overriding of such key will have no effect. For example: php $options = ['class' => ['persistent' => 'initial']]; Html::addCssClass($options, ['persistent' => 'override']); var_dump($options['class']); // outputs: array('persistent' => 'initial');
public static addCssClass ( array &$options, string | array $class )
$options array the options to be modified.
$class string | array the CSS class(es) to be added

addCssStyle() 공개 정적인 메소드

If the options already contain a style element, the new style will be merged with the existing one. If a CSS property exists in both the new and the old styles, the old one may be overwritten if $overwrite is true. For example, php Html::addCssStyle($options, 'width: 100px; height: 200px');
또한 보기: removeCssStyle()
또한 보기: cssStyleFromArray()
또한 보기: cssStyleToArray()
public static addCssStyle ( array &$options, string | array $style, boolean $overwrite = true )
$options array the HTML options to be modified.
$style string | array the new style string (e.g. `'width: 100px; height: 200px'`) or array (e.g. `['width' => '100px', 'height' => '200px']`).
$overwrite boolean whether to overwrite existing CSS properties if the new style contain them too.

beginForm() 공개 정적인 메소드

Generates a form start tag.
또한 보기: endForm()
public static beginForm ( array | string $action = '', string $method = 'post', array $options = [] ) : string
$action array | string the form action URL. This parameter will be processed by [[Url::to()]].
$method string the form submission method, such as "post", "get", "put", "delete" (case-insensitive). Since most browsers only support "post" and "get", if other methods are given, they will be simulated using "post", and a hidden input will be added which contains the actual method type. See [[\yii\web\Request::methodParam]] for more details.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered. Special options: - `csrf`: whether to generate the CSRF hidden input. Defaults to true.
리턴 string the generated form start tag.

beginTag() 공개 정적인 메소드

Generates a start tag.
또한 보기: endTag()
또한 보기: tag()
public static beginTag ( string | boolean | null $name, array $options = [] ) : string
$name string | boolean | null the tag name. If $name is `null` or `false`, the corresponding content will be rendered without any tag.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated start tag

booleanInput() 보호된 정적인 메소드

Generates a boolean input.
부터: 2.0.9
protected static booleanInput ( string $type, string $name, boolean $checked = false, array $options = [] ) : string
$type string the input type. This can be either `radio` or `checkbox`.
$name string the name attribute.
$checked boolean whether the checkbox should be checked.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - uncheck: string, the value associated with the uncheck state of the checkbox. When this attribute is present, a hidden input will be generated so that if the checkbox is not checked and is submitted, the value of this attribute will still be submitted to the server via the hidden input. - label: string, a label displayed next to the checkbox. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should [[encode()]] it to prevent XSS attacks. When this option is specified, the checkbox will be enclosed by a label tag. - labelOptions: array, the HTML attributes for the label tag. Do not set this option unless you set the "label" option. The rest of the options will be rendered as the attributes of the resulting checkbox tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated checkbox tag

button() 공개 정적인 메소드

Generates a button tag.
public static button ( string $content = 'Button', array $options = [] ) : string
$content string the content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated button tag

buttonInput() 공개 정적인 메소드

Generates an input button.
public static buttonInput ( string $label = 'Button', array $options = [] ) : string
$label string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated button tag

checkbox() 공개 정적인 메소드

Generates a checkbox input.
public static checkbox ( string $name, boolean $checked = false, array $options = [] ) : string
$name string the name attribute.
$checked boolean whether the checkbox should be checked.
$options array the tag options in terms of name-value pairs. See [[booleanInput()]] for details about accepted attributes.
리턴 string the generated checkbox tag

checkboxList() 공개 정적인 메소드

A checkbox list allows multiple selection, like BaseHtml::listBox. As a result, the corresponding submitted value is an array.
public static checkboxList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string
$name string the name attribute of each checkbox.
$selection string | array | null the selected value(s). String for single or array for multiple selection(s).
$items array the data item used to generate the checkboxes. The array keys are the checkbox values, while the array values are the corresponding labels.
$options array options (name => config) for the checkbox list container tag. The following options are specially handled: - tag: string|false, the tag name of the container element. False to render checkbox without container. See also [[tag()]]. - unselect: string, the value that should be submitted when none of the checkboxes is selected. By setting this option, a hidden input will be generated. - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if `item` option is set. - separator: string, the HTML code that separates items. - itemOptions: array, the options for generating the checkbox tag using [[checkbox()]]. - item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ```php function ($index, $label, $name, $checked, $value) ``` where $index is the zero-based index of the checkbox in the whole list; $label is the label for the checkbox; and $name, $value and $checked represent the name, value and the checked status of the checkbox input, respectively. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated checkbox list

csrfMetaTags() 공개 정적인 메소드

Generates the meta tags containing CSRF token information.
또한 보기: Request::enableCsrfValidation
public static csrfMetaTags ( ) : string
리턴 string the generated meta tags

cssFile() 공개 정적인 메소드

Generates a link tag that refers to an external CSS file.
또한 보기: Url::to()
public static cssFile ( array | string $url, array $options = [] ) : string
$url array | string the URL of the external CSS file. This parameter will be processed by [[Url::to()]].
$options array the tag options in terms of name-value pairs. The following options are specially handled: - condition: specifies the conditional comments for IE, e.g., `lt IE 9`. When this is specified, the generated `link` tag will be enclosed within the conditional comments. This is mainly useful for supporting old versions of IE browsers. - noscript: if set to true, `link` tag will be wrapped into `
리턴 string the generated link tag

cssStyleFromArray() 공개 정적인 메소드

For example, php print_r(Html::cssStyleFromArray(['width' => '100px', 'height' => '200px'])); will display: 'width: 100px; height: 200px;'
public static cssStyleFromArray ( array $style ) : string
$style array the CSS style array. The array keys are the CSS property names, and the array values are the corresponding CSS property values.
리턴 string the CSS style string. If the CSS style is empty, a null will be returned.

cssStyleToArray() 공개 정적인 메소드

The array keys are the CSS property names, and the array values are the corresponding CSS property values. For example, php print_r(Html::cssStyleToArray('width: 100px; height: 200px;')); will display: ['width' => '100px', 'height' => '200px']
public static cssStyleToArray ( string $style ) : array
$style string the CSS style string
리턴 array the array representation of the CSS style

decode() 공개 정적인 메소드

This is the opposite of BaseHtml::encode.
또한 보기: encode()
또한 보기: http://www.php.net/manual/en/function.htmlspecialchars-decode.php
public static decode ( string $content ) : string
$content string the content to be decoded
리턴 string the decoded content

dropDownList() 공개 정적인 메소드

Generates a drop-down list.
public static dropDownList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string
$name string the input name
$selection string | array | null the selected value(s). String for single or array for multiple selection(s).
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[\yii\helpers\ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: ```php ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], ``` - options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, ```php [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]; ``` - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character. Defaults to false. - encode: bool, whether to encode option prompt and option value characters. Defaults to `true`. This option is available since 2.0.3. The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated drop-down list tag

encode() 공개 정적인 메소드

The [[\yii\base\Application::charset|application charset]] will be used for encoding.
또한 보기: decode()
또한 보기: http://www.php.net/manual/en/function.htmlspecialchars.php
public static encode ( string $content, boolean $doubleEncode = true ) : string
$content string the content to be encoded
$doubleEncode boolean whether to encode HTML entities in `$content`. If false, HTML entities in `$content` will not be further encoded.
리턴 string the encoded content

endForm() 공개 정적인 메소드

Generates a form end tag.
또한 보기: beginForm()
public static endForm ( ) : string
리턴 string the generated tag

endTag() 공개 정적인 메소드

Generates an end tag.
또한 보기: beginTag()
또한 보기: tag()
public static endTag ( string | boolean | null $name ) : string
$name string | boolean | null the tag name. If $name is `null` or `false`, the corresponding content will be rendered without any tag.
리턴 string the generated end tag

error() 공개 정적인 메소드

Note that even if there is no validation error, this method will still return an empty error tag.
public static error ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array the tag options in terms of name-value pairs. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. The following options are specially handled: - tag: this specifies the tag name. If not set, "div" will be used. See also [[tag()]]. - encode: boolean, if set to false then the error message won't be encoded. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated label tag

errorSummary() 공개 정적인 메소드

If there is no validation error, an empty error summary markup will still be generated, but it will be hidden.
public static errorSummary ( Model | Model[] $models, array $options = [] ) : string
$models yii\base\Model | yii\base\Model[] the model(s) whose validation errors are to be displayed.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - header: string, the header HTML for the error summary. If not set, a default prompt string will be used. - footer: string, the footer HTML for the error summary. Defaults to empty string. - encode: boolean, if set to false then the error messages won't be encoded. Defaults to `true`. - showAllErrors: boolean, if set to true every error message for each attribute will be shown otherwise only the first error message for each attribute will be shown. Defaults to `false`. Option is available since 2.0.10. The rest of the options will be rendered as the attributes of the container tag.
리턴 string the generated error summary

escapeJsRegularExpression() 공개 정적인 메소드

Escapes regular expression to use in JavaScript
부터: 2.0.6
public static escapeJsRegularExpression ( string $regexp ) : string
$regexp string the regular expression to be escaped.
리턴 string the escaped result.

fileInput() 공개 정적인 메소드

To use a file input field, you should set the enclosing form's "enctype" attribute to be "multipart/form-data". After the form is submitted, the uploaded file information can be obtained via $_FILES[$name] (see PHP documentation).
public static fileInput ( string $name, string $value = null, array $options = [] ) : string
$name string the name attribute.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated file input tag

getAttributeName() 공개 정적인 메소드

An attribute expression is an attribute name prefixed and/or suffixed with array indexes. It is mainly used in tabular data input and/or input of array type. Below are some examples: - [0]content is used in tabular data input to represent the "content" attribute for the first model in tabular input; - dates[0] represents the first array element of the "dates" attribute; - [0]dates[0] represents the first array element of the "dates" attribute for the first model in tabular input. If $attribute has neither prefix nor suffix, it will be returned back without change.
public static getAttributeName ( string $attribute ) : string
$attribute string the attribute name or expression
리턴 string the attribute name without prefix and suffix.

getAttributeValue() 공개 정적인 메소드

For an attribute expression like [0]dates[0], this method will return the value of $model->dates[0]. See BaseHtml::getAttributeName for more details about attribute expression. If an attribute value is an instance of [[ActiveRecordInterface]] or an array of such instances, the primary value(s) of the AR instance(s) will be returned instead.
public static getAttributeValue ( Model $model, string $attribute ) : string | array
$model yii\base\Model the model object
$attribute string the attribute name or expression
리턴 string | array the corresponding attribute value

getInputId() 공개 정적인 메소드

This method converts the result BaseHtml::getInputName into a valid input ID. For example, if BaseHtml::getInputName returns Post[content], this method will return post-content.
public static getInputId ( Model $model, string $attribute ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for explanation of attribute expression.
리턴 string the generated input ID

getInputName() 공개 정적인 메소드

This method generates a name that can be used as the input name to collect user input for the specified attribute. The name is generated according to the [[Model::formName|form name]] of the model and the given attribute name. For example, if the form name of the Post model is Post, then the input name generated for the content attribute would be Post[content]. See BaseHtml::getAttributeName for explanation of attribute expression.
public static getInputName ( Model $model, string $attribute ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression
리턴 string the generated input name

hiddenInput() 공개 정적인 메소드

Generates a hidden input field.
public static hiddenInput ( string $name, string $value = null, array $options = [] ) : string
$name string the name attribute.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated hidden input tag

img() 공개 정적인 메소드

Generates an image tag.
public static img ( array | string $src, array $options = [] ) : string
$src array | string the image URL. This parameter will be processed by [[Url::to()]].
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated image tag

input() 공개 정적인 메소드

Generates an input type of the given type.
public static input ( string $type, string $name = null, string $value = null, array $options = [] ) : string
$type string the type attribute.
$name string the name attribute. If it is null, the name attribute will not be generated.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated input tag

jsFile() 공개 정적인 메소드

Generates a script tag that refers to an external JavaScript file.
또한 보기: Url::to()
public static jsFile ( string $url, array $options = [] ) : string
$url string the URL of the external JavaScript file. This parameter will be processed by [[Url::to()]].
$options array the tag options in terms of name-value pairs. The following option is specially handled: - condition: specifies the conditional comments for IE, e.g., `lt IE 9`. When this is specified, the generated `script` tag will be enclosed within the conditional comments. This is mainly useful for supporting old versions of IE browsers. The rest of the options will be rendered as the attributes of the resulting script tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated script tag

label() 공개 정적인 메소드

Generates a label tag.
public static label ( string $content, string $for = null, array $options = [] ) : string
$content string label text. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should [[encode()]] it to prevent XSS attacks.
$for string the ID of the HTML element that this label is associated with. If this is null, the "for" attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated label tag

listBox() 공개 정적인 메소드

Generates a list box.
public static listBox ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string
$name string the input name
$selection string | array | null the selected value(s). String for single or array for multiple selection(s).
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[\yii\helpers\ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$options array the tag options in terms of name-value pairs. The following options are specially handled: - prompt: string, a prompt text to be displayed as the first option. Since version 2.0.11 you can use an array to override the value and to set other tag attributes: ```php ['text' => 'Please select', 'options' => ['value' => 'none', 'class' => 'prompt', 'label' => 'Select']], ``` - options: array, the attributes for the select option tags. The array keys must be valid option values, and the array values are the extra attributes for the corresponding option tags. For example, ```php [ 'value1' => ['disabled' => true], 'value2' => ['label' => 'value 2'], ]; ``` - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options', except that the array keys represent the optgroup labels specified in $items. - unselect: string, the value that will be submitted when no option is selected. When this attribute is set, a hidden field will be generated so that if no option is selected in multiple mode, we can still obtain the posted unselect value. - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character. Defaults to false. - encode: bool, whether to encode option prompt and option value characters. Defaults to `true`. This option is available since 2.0.3. The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated list box tag

mailto() 공개 정적인 메소드

Generates a mailto hyperlink.
public static mailto ( string $text, string $email = null, array $options = [] ) : string
$text string link body. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$email string email address. If this is null, the first parameter (link body) will be treated as the email address and used.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated mailto link

ol() 공개 정적인 메소드

Generates an ordered list.
public static ol ( array | Traversable $items, array $options = [] ) : string
$items array | Traversable the items for generating the list. Each item generates a single list item. Note that items will be automatically HTML encoded if `$options['encode']` is not set or true.
$options array options (name => config) for the radio button list. The following options are supported: - encode: boolean, whether to HTML-encode the items. Defaults to true. This option is ignored if the `item` option is specified. - itemOptions: array, the HTML attributes for the `li` tags. This option is ignored if the `item` option is specified. - item: callable, a callback that is used to generate each individual list item. The signature of this callback must be: ```php function ($item, $index) ``` where $index is the array key corresponding to `$item` in `$items`. The callback should return the whole list item tag. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated ordered list. An empty string is returned if `$items` is empty.

passwordInput() 공개 정적인 메소드

Generates a password input field.
public static passwordInput ( string $name, string $value = null, array $options = [] ) : string
$name string the name attribute.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated password input tag

radio() 공개 정적인 메소드

Generates a radio button input.
public static radio ( string $name, boolean $checked = false, array $options = [] ) : string
$name string the name attribute.
$checked boolean whether the radio button should be checked.
$options array the tag options in terms of name-value pairs. See [[booleanInput()]] for details about accepted attributes.
리턴 string the generated radio button tag

radioList() 공개 정적인 메소드

A radio button list is like a checkbox list, except that it only allows single selection.
public static radioList ( string $name, string | array | null $selection = null, array $items = [], array $options = [] ) : string
$name string the name attribute of each radio button.
$selection string | array | null the selected value(s). String for single or array for multiple selection(s).
$items array the data item used to generate the radio buttons. The array keys are the radio button values, while the array values are the corresponding labels.
$options array options (name => config) for the radio button list container tag. The following options are specially handled: - tag: string|false, the tag name of the container element. False to render radio buttons without container. See also [[tag()]]. - unselect: string, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated. - encode: boolean, whether to HTML-encode the checkbox labels. Defaults to true. This option is ignored if `item` option is set. - separator: string, the HTML code that separates items. - itemOptions: array, the options for generating the radio button tag using [[radio()]]. - item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be: ```php function ($index, $label, $name, $checked, $value) ``` where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio button; and $name, $value and $checked represent the name, value and the checked status of the radio button input, respectively. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated radio button list

removeCssClass() 공개 정적인 메소드

Removes a CSS class from the specified options.
public static removeCssClass ( array &$options, string | array $class )
$options array the options to be modified.
$class string | array the CSS class(es) to be removed

removeCssStyle() 공개 정적인 메소드

For example, php Html::removeCssStyle($options, ['width', 'height']);
또한 보기: addCssStyle()
public static removeCssStyle ( array &$options, string | array $properties )
$options array the HTML options to be modified.
$properties string | array the CSS properties to be removed. You may use a string if you are removing a single property.

renderSelectOptions() 공개 정적인 메소드

Renders the option tags that can be used by BaseHtml::dropDownList and BaseHtml::listBox.
public static renderSelectOptions ( string | array | null $selection, array $items, array &$tagOptions = [] ) : string
$selection string | array | null the selected value(s). String for single or array for multiple selection(s).
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[\yii\helpers\ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$tagOptions array the $options parameter that is passed to the [[dropDownList()]] or [[listBox()]] call. This method will take out these elements, if any: "prompt", "options" and "groups". See more details in [[dropDownList()]] for the explanation of these elements.
리턴 string the generated list options

renderTagAttributes() 공개 정적인 메소드

Attributes whose values are of boolean type will be treated as boolean attributes. Attributes whose values are null will not be rendered. The values of attributes will be HTML-encoded using BaseHtml::encode. 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". Additionally 'data' => ['params' => ['id' => 1, 'name' => 'yii'], 'status' => 'ok'] will be rendered as: data-params='{"id":1,"name":"yii"}' data-status="ok".
public static renderTagAttributes ( array $attributes ) : string
$attributes array attributes to be rendered. The attribute values will be HTML-encoded using [[encode()]].
리턴 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 in a tag. If there is no attribute, an empty string will be returned.

resetButton() 공개 정적인 메소드

Generates a reset button tag.
public static resetButton ( string $content = 'Reset', array $options = [] ) : string
$content string the content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated reset button tag

resetInput() 공개 정적인 메소드

Generates a reset input button.
public static resetInput ( string $label = 'Reset', array $options = [] ) : string
$label string the value attribute. If it is null, the value attribute will not be generated.
$options array the attributes of the button tag. The values will be HTML-encoded using [[encode()]]. Attributes whose value is null will be ignored and not put in the tag returned. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated button tag

script() 공개 정적인 메소드

Generates a script tag.
public static script ( string $content, array $options = [] ) : string
$content string the script content
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated script tag

style() 공개 정적인 메소드

Generates a style tag.
public static style ( string $content, array $options = [] ) : string
$content string the style content
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated style tag

submitButton() 공개 정적인 메소드

Be careful when naming form elements such as submit buttons. According to the jQuery documentation there are some reserved names that can cause conflicts, e.g. submit, length, or method.
public static submitButton ( string $content = 'Submit', array $options = [] ) : string
$content string the content enclosed within the button tag. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated submit button tag

submitInput() 공개 정적인 메소드

Be careful when naming form elements such as submit buttons. According to the jQuery documentation there are some reserved names that can cause conflicts, e.g. submit, length, or method.
public static submitInput ( string $label = 'Submit', array $options = [] ) : string
$label string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated button tag

tag() 공개 정적인 메소드

Generates a complete HTML tag.
또한 보기: beginTag()
또한 보기: endTag()
public static tag ( string | boolean | null $name, string $content = '', array $options = [] ) : string
$name string | boolean | null the tag name. If $name is `null` or `false`, the corresponding content will be rendered without any tag.
$content string the content to be enclosed between the start and end tags. It will not be HTML-encoded. If this is coming from end users, you should consider [[encode()]] it to prevent XSS attacks.
$options array the HTML tag attributes (HTML 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. For example when using `['class' => 'my-class', 'target' => '_blank', 'value' => null]` it will result in the html attributes rendered like this: `class="my-class" target="_blank"`. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated HTML tag

textInput() 공개 정적인 메소드

Generates a text input field.
public static textInput ( string $name, string $value = null, array $options = [] ) : string
$name string the name attribute.
$value string the value attribute. If it is null, the value attribute will not be generated.
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated text input tag

textarea() 공개 정적인 메소드

Generates a text area input.
public static textarea ( string $name, string $value = '', array $options = [] ) : string
$name string the input name
$value string the input value. Note that it will be encoded using [[encode()]].
$options array 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 [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered. The following special options are recognized: - `doubleEncode`: whether to double encode HTML entities in `$value`. If `false`, HTML entities in `$value` will not be further encoded. This option is available since version 2.0.11.
리턴 string the generated text area tag

ul() 공개 정적인 메소드

Generates an unordered list.
public static ul ( array | Traversable $items, array $options = [] ) : string
$items array | Traversable the items for generating the list. Each item generates a single list item. Note that items will be automatically HTML encoded if `$options['encode']` is not set or true.
$options array options (name => config) for the radio button list. The following options are supported: - encode: boolean, whether to HTML-encode the items. Defaults to true. This option is ignored if the `item` option is specified. - separator: string, the HTML code that separates items. Defaults to a simple newline (`"\n"`). This option is available since version 2.0.7. - itemOptions: array, the HTML attributes for the `li` tags. This option is ignored if the `item` option is specified. - item: callable, a callback that is used to generate each individual list item. The signature of this callback must be: ```php function ($item, $index) ``` where $index is the array key corresponding to `$item` in `$items`. The callback should return the whole list item tag. See [[renderTagAttributes()]] for details on how attributes are being rendered.
리턴 string the generated unordered list. An empty list tag will be returned if `$items` is empty.

프로퍼티 상세

$attributeOrder 공개적으로 정적으로 프로퍼티

the preferred order of attributes in a tag. This mainly affects the order of the attributes that are rendered by BaseHtml::renderTagAttributes.
public static $attributeOrder

$dataAttributes 공개적으로 정적으로 프로퍼티

list of tag attributes that should be specially handled when their values are of array type. In particular, if the value of the data attribute is ['name' => 'xyz', 'age' => 13], two attributes will be generated instead of one: data-name="xyz" data-age="13".
부터: 2.0.3
public static $dataAttributes

$voidElements 공개적으로 정적으로 프로퍼티

list of void elements (element name => 1)
또한 보기: http://www.w3.org/TR/html-markup/syntax.html#void-element
public static $voidElements