From a78d8b59b2ccbcbd6e9909ddd1cfb540641a30e0 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sun, 8 Mar 2015 03:44:02 +0100 Subject: [PATCH] fixed issue with wrongly assigned label in bootstrap fixes #5984 --- ActiveField.php | 3 +++ CHANGELOG.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ActiveField.php b/ActiveField.php index 237b41a..2f72b28 100644 --- a/ActiveField.php +++ b/ActiveField.php @@ -376,6 +376,9 @@ class ActiveField extends \yii\widgets\ActiveField $label = Html::encode($this->model->getAttributeLabel($attribute)); } } + if (!isset($options['for'])) { + $options['for'] = Html::getInputId($this->model, $this->attribute); + } $this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{endLabel}'] = Html::endTag('label'); $this->parts['{labelTitle}'] = $label; diff --git a/CHANGELOG.md b/CHANGELOG.md index d3c81ba..7603e4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Yii Framework 2 bootstrap extension Change Log 2.0.4 under development ----------------------- -- no changes in this release. +- Bug #5984: `yii\bootstrap\Activefield::checkbox()` caused browser to link label to the wrong input (cebe) 2.0.3 March 01, 2015