2021-07-09 17:53:24 +08:00
|
|
|
Html helper
|
|
|
|
===========
|
|
|
|
|
|
|
|
Bootstrap introduces many consistent HTML constructions and skeletons, which allow creating different visual effects.
|
|
|
|
Only the most complex of them are covered by the widgets provided with this extension. The rest should be composed manually
|
|
|
|
using direct HTML composition.
|
2021-08-03 16:22:50 +08:00
|
|
|
However, several special Bootstrap markup cases are covered by the [[\yii\bootstrap5\Html]] helper.
|
|
|
|
[[\yii\bootstrap5\Html]] is an enhanced version of the regular [[\yii\helpers\Html]] dedicated to the Bootstrap needs.
|
2021-07-09 17:53:24 +08:00
|
|
|
It provides some useful methods like:
|
|
|
|
|
2021-08-05 15:21:05 +08:00
|
|
|
- `staticControl()` - allows rendering of form "[static controls](https://getbootstrap.com/docs/5.1/forms/form-control/#readonly-plain-text)"
|
2021-07-09 17:53:24 +08:00
|
|
|
|
2021-08-03 16:22:50 +08:00
|
|
|
As [[\yii\bootstrap5\Html]] extends [[\yii\helpers\Html]], it can be used as a substitute, so you don't need them both
|
2021-07-09 17:53:24 +08:00
|
|
|
inside your view files.
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
```php
|
|
|
|
<?php
|
2021-08-03 16:22:50 +08:00
|
|
|
use yii\bootstrap5\Html;
|
2021-07-09 17:53:24 +08:00
|
|
|
?>
|
|
|
|
<?= Button::widget([
|
2021-08-03 16:22:50 +08:00
|
|
|
'label' => Html::encode('Save & apply'),
|
2021-07-09 17:53:24 +08:00
|
|
|
'encodeLabel' => false,
|
|
|
|
'options' => ['class' => 'btn-primary'],
|
|
|
|
]); ?>
|
|
|
|
```
|
|
|
|
|
2021-08-03 16:22:50 +08:00
|
|
|
> Attention: do not confuse [[\yii\bootstrap5\Html]] and [[\yii\helpers\Html]], be careful of which class
|
2021-07-09 17:53:24 +08:00
|
|
|
you are using inside your views.
|