added Floating label to docs and fixed template in field

This commit is contained in:
Simon Karlen 2021-08-03 10:41:30 +02:00
parent 2e885dd544
commit 4063a438e6
No known key found for this signature in database
GPG Key ID: 0630C27D666EBCC3
4 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,9 @@ Die grössten Änderungen finden Sie hier zusammengefasst:
### ActiveForm ### ActiveForm
Es gibt eine neue Konstante [[yii\bootstrap5\ActiveForm::LAYOUT_FLOATING]]. Sie repräsentiert ein neues
[neues Formular-Layout](https://getbootstrap.com/docs/5.0/forms/floating-labels/) in Bootstrap 5.
### Breadcrumbs ### Breadcrumbs
### ButtonDropdown ### ButtonDropdown

View File

@ -16,6 +16,8 @@ yii2-bootstrap5 は、Bootstrap 4 から Bootstrap 5 への移行ガイドに従
### ActiveForm ### ActiveForm
新しい定数[[yii\bootstrap5\ActiveForm::LAYOUT_FLOATING]]があります。 Bootstrap5で導入された[新しいフォームレイアウト](https://getbootstrap.com/docs/5.0/forms/floating-labels/)です。
### Breadcrumbs ### Breadcrumbs
### ButtonDropdown ### ButtonDropdown

View File

@ -16,6 +16,9 @@ The most notable changes are summarized below:
### ActiveForm ### ActiveForm
There is a new constant [[yii\bootstrap5\ActiveForm::LAYOUT_FLOATING]]. It's a
[new form layout](https://getbootstrap.com/docs/5.0/forms/floating-labels/) introduced in Bootstrap 5.
### Breadcrumbs ### Breadcrumbs
### ButtonDropdown ### ButtonDropdown

View File

@ -518,6 +518,9 @@ class ActiveField extends \yii\widgets\ActiveField
$config['enableError'] = false; $config['enableError'] = false;
Html::addCssClass($config['labelOptions'], ['screenreader' => 'visually-hidden']); Html::addCssClass($config['labelOptions'], ['screenreader' => 'visually-hidden']);
} elseif ($layout === ActiveForm::LAYOUT_FLOATING) {
$config['template'] = "{input}\n{label}\n{error}\n{hint}";
Html::addCssClass($config['options'], ['layout' => 'form-floating mt-3']);
} }
return $config; return $config;