Browse Source

Merge pull request #18 from mikehaertl/7895-label-option

Fix issue 7895 (yii2): label option ignored
tags/2.0.4
Alexander Makarov 10 years ago
parent
commit
0ea7c2dd96
  1. 8
      ActiveField.php
  2. 1
      CHANGELOG.md

8
ActiveField.php

@ -201,6 +201,9 @@ class ActiveField extends \yii\widgets\ActiveField
$this->template = $options['template']; $this->template = $options['template'];
unset($options['template']); unset($options['template']);
} }
if (isset($options['label'])) {
$this->parts['{labelTitle}'] = $options['label'];
}
if ($this->form->layout === 'horizontal') { if ($this->form->layout === 'horizontal') {
Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']); Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']);
} }
@ -223,6 +226,9 @@ class ActiveField extends \yii\widgets\ActiveField
$this->template = $options['template']; $this->template = $options['template'];
unset($options['template']); unset($options['template']);
} }
if (isset($options['label'])) {
$this->parts['{labelTitle}'] = $options['label'];
}
if ($this->form->layout === 'horizontal') { if ($this->form->layout === 'horizontal') {
Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']); Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']);
} }
@ -381,6 +387,8 @@ class ActiveField extends \yii\widgets\ActiveField
} }
$this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{beginLabel}'] = Html::beginTag('label', $options);
$this->parts['{endLabel}'] = Html::endTag('label'); $this->parts['{endLabel}'] = Html::endTag('label');
if (!isset($this->parts['{labelTitle}'])) {
$this->parts['{labelTitle}'] = $label; $this->parts['{labelTitle}'] = $label;
} }
}
} }

1
CHANGELOG.md

@ -4,6 +4,7 @@ Yii Framework 2 bootstrap extension Change Log
2.0.4 under development 2.0.4 under development
----------------------- -----------------------
- Bug #18: `label` option ignored by `yii\bootstrap\Activefield::checkbox()` and `yii\bootstrap\Activefield::radio()` (mikehaertl)
- Bug #5984: `yii\bootstrap\Activefield::checkbox()` caused browser to link label to the wrong input (cebe) - Bug #5984: `yii\bootstrap\Activefield::checkbox()` caused browser to link label to the wrong input (cebe)
- Enh #7633: Added `ActionColumn::$buttonOptions` for defining HTML options to be added to the default buttons (cebe) - Enh #7633: Added `ActionColumn::$buttonOptions` for defining HTML options to be added to the default buttons (cebe)
- Enh: Added `Nav::$dropDownCaret` to allow customization of the dropdown caret symbol (cebe) - Enh: Added `Nav::$dropDownCaret` to allow customization of the dropdown caret symbol (cebe)

Loading…
Cancel
Save