Commit 66083423 by larnu

Minor fixes for helper-html.md

parent 87b10f2c
...@@ -88,7 +88,6 @@ could be converted there and forth by using [[yii\helpers\Html::cssStyleFromArra ...@@ -88,7 +88,6 @@ could be converted there and forth by using [[yii\helpers\Html::cssStyleFromArra
[[yii\helpers\Html::cssStyleToArray()|cssStyleToArray()]]. The [[yii\helpers\Html::removeCssStyle()|removeCssStyle()]] [[yii\helpers\Html::cssStyleToArray()|cssStyleToArray()]]. The [[yii\helpers\Html::removeCssStyle()|removeCssStyle()]]
method accepts an array of properties to remove. If it's going to be a single property it could be specified as string. method accepts an array of properties to remove. If it's going to be a single property it could be specified as string.
Encoding and decoding content <a name="encoding-and-decoding-content"></a> Encoding and decoding content <a name="encoding-and-decoding-content"></a>
-------------------------------------------------------------------------- --------------------------------------------------------------------------
...@@ -106,7 +105,6 @@ echo $userName; ...@@ -106,7 +105,6 @@ echo $userName;
$decodedUserName = Html::decode($userName); $decodedUserName = Html::decode($userName);
``` ```
Forms Forms
----- -----
...@@ -158,10 +156,10 @@ directly. ...@@ -158,10 +156,10 @@ directly.
The most generic methods are: The most generic methods are:
```php ```php
type, input name, input value, options // type, input name, input value, options
<?= Html::input('text', 'username', $user->name, ['class' => $username]) ?> <?= Html::input('text', 'username', $user->name, ['class' => $username]) ?>
type, model, model attribute name, options // type, model, model attribute name, options
<?= Html::activeInput('text', $user, 'name', ['class' => $username]) ?> <?= Html::activeInput('text', $user, 'name', ['class' => $username]) ?>
``` ```
...@@ -213,7 +211,6 @@ If not, use radio list: ...@@ -213,7 +211,6 @@ If not, use radio list:
<?= Html::activeRadioList($user, 'role', ArrayHelper::map($roleModels, 'id', 'name')) ?> <?= Html::activeRadioList($user, 'role', ArrayHelper::map($roleModels, 'id', 'name')) ?>
``` ```
### Labels and errors ### Labels and errors
...@@ -237,7 +234,6 @@ To display individual error: ...@@ -237,7 +234,6 @@ To display individual error:
<?= Html::error($post, 'title', ['class' => 'error']) ?> <?= Html::error($post, 'title', ['class' => 'error']) ?>
``` ```
### Names and values ### Names and values
There are methods to get names, ids and values for input fields based on the model. These are mainly used internally There are methods to get names, ids and values for input fields based on the model. These are mainly used internally
...@@ -272,7 +268,6 @@ In order to get attribute name without suffixes or prefixes one can use the foll ...@@ -272,7 +268,6 @@ In order to get attribute name without suffixes or prefixes one can use the foll
echo Html::getAttributeName('dates[0]'); echo Html::getAttributeName('dates[0]');
``` ```
Styles and scripts Styles and scripts
------------------ ------------------
...@@ -282,14 +277,14 @@ There two methods to generate tags wrapping embedded styles and scripts: ...@@ -282,14 +277,14 @@ There two methods to generate tags wrapping embedded styles and scripts:
```php ```php
<?= Html::style('.danger { color: #f00; }') ?> <?= Html::style('.danger { color: #f00; }') ?>
Gives you // Gives you
<style>.danger { color: #f00; }</style> <style>.danger { color: #f00; }</style>
<?= Html::script('alert("Hello!");', ['defer' => true]); <?= Html::script('alert("Hello!");', ['defer' => true]);
Gives you // Gives you
<script defer>alert("Hello!");</script> <script defer>alert("Hello!");</script>
``` ```
...@@ -299,7 +294,7 @@ If you want to link external style from CSS file: ...@@ -299,7 +294,7 @@ If you want to link external style from CSS file:
```php ```php
<?= Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']) ?> <?= Html::cssFile('@web/css/ie5.css', ['condition' => 'IE 5']) ?>
generates // generates
<!--[if IE 5]> <!--[if IE 5]>
<link href="http://example.com/css/ie5.css" /> <link href="http://example.com/css/ie5.css" />
...@@ -341,7 +336,6 @@ In you need to generate `mailto` link you can use the following code: ...@@ -341,7 +336,6 @@ In you need to generate `mailto` link you can use the following code:
<?= Html::mailto('Contact us', 'admin@example.com') ?> <?= Html::mailto('Contact us', 'admin@example.com') ?>
``` ```
Images Images
------ ------
...@@ -350,7 +344,7 @@ In order to generate image tag use the following: ...@@ -350,7 +344,7 @@ In order to generate image tag use the following:
```php ```php
<?= Html::img('@web/images/logo.png', ['alt' => 'My logo']) ?> <?= Html::img('@web/images/logo.png', ['alt' => 'My logo']) ?>
generates // generates
<img src="http://example.com/images/logo.png" alt="My logo" /> <img src="http://example.com/images/logo.png" alt="My logo" />
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment