helpers\BaseHtml renderTagAttributes()

renderTagAttributes() public static method

Renders the HTML tag attributes.

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 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 string renderTagAttributes ( $attributes )
$attributes array

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 in a tag. If there is no attribute, an empty string will be returned.

doc_Yii
2016-10-30 17:05:15
Comments
Leave a Comment

Please login to continue.