diff --git a/docs/guide-de/migrating-yii2-bootstrap.md b/docs/guide-de/migrating-yii2-bootstrap.md index 388cc10..91a17d3 100644 --- a/docs/guide-de/migrating-yii2-bootstrap.md +++ b/docs/guide-de/migrating-yii2-bootstrap.md @@ -16,6 +16,9 @@ Die grössten Änderungen finden Sie hier zusammengefasst: ### 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 ### ButtonDropdown diff --git a/docs/guide-ja/migrating-yii2-bootstrap.md b/docs/guide-ja/migrating-yii2-bootstrap.md index 7bb59a4..04e7bc2 100644 --- a/docs/guide-ja/migrating-yii2-bootstrap.md +++ b/docs/guide-ja/migrating-yii2-bootstrap.md @@ -16,6 +16,8 @@ yii2-bootstrap5 は、Bootstrap 4 から Bootstrap 5 への移行ガイドに従 ### ActiveForm +新しい定数[[yii\bootstrap5\ActiveForm::LAYOUT_FLOATING]]があります。 Bootstrap5で導入された[新しいフォームレイアウト](https://getbootstrap.com/docs/5.0/forms/floating-labels/)です。 + ### Breadcrumbs ### ButtonDropdown diff --git a/docs/guide/migrating-yii2-bootstrap.md b/docs/guide/migrating-yii2-bootstrap.md index 47bd135..7275908 100644 --- a/docs/guide/migrating-yii2-bootstrap.md +++ b/docs/guide/migrating-yii2-bootstrap.md @@ -16,6 +16,9 @@ The most notable changes are summarized below: ### 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 ### ButtonDropdown diff --git a/src/ActiveField.php b/src/ActiveField.php index 673c75a..75cb1b0 100644 --- a/src/ActiveField.php +++ b/src/ActiveField.php @@ -518,6 +518,9 @@ class ActiveField extends \yii\widgets\ActiveField $config['enableError'] = false; 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;