From 296fc72d63440d3018dbaefff4d6114e1932360d Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Tue, 28 Jan 2014 11:40:19 +0100 Subject: [PATCH] more clear docs about html options fixes yiisoft/yii#2844 --- framework/helpers/BaseHtml.php | 7 +++++-- framework/helpers/Html.php | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 6fcf85e..767554e 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -113,9 +113,12 @@ class BaseHtml * @param string $name the tag name * @param string $content 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. - * @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 [[encode()]]. + * @param array $options 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"`. * @return string the generated HTML tag * @see beginTag() * @see endTag() diff --git a/framework/helpers/Html.php b/framework/helpers/Html.php index f4fbbba..7428e4b 100644 --- a/framework/helpers/Html.php +++ b/framework/helpers/Html.php @@ -10,6 +10,10 @@ namespace yii\helpers; /** * Html provides a set of static methods for generating commonly used HTML tags. * + * Nearly all of the methods in this class allow setting additional html attributes for the html + * tags they generate. You can specify for example. 'class', 'style' or 'id' for an html element + * using the `$options` parameter. See the documentation of the [[tag()]] method for more details. + * * @author Qiang Xue * @since 2.0 */