kartik-v / yii2-widget-activeform

Enhanced Yii2 active-form and active-field with full bootstrap styling support (sub repo split from yii2-widgets).
http://demos.krajee.com/widget-details/active-form
Other
64 stars 35 forks source link

For checkbox labels with 'label' option present, {beginLabel} and {endLabel} do not get rendered [$25] #112

Closed nilsenpaul closed 6 years ago

nilsenpaul commented 6 years ago

Steps to reproduce the issue

  1. Install Builder, use FormGrid
  2. Set bsVersion => '4.*', in config/params.php
  3. Create a checkbox with a label
    <?= FormGrid::widget([
           'model' => $profile,
           'form' => $form,
           'autoGenerateColumns' => true,
           'rows' => [
             [
                 'attributes' => [
                     'gdpr' => [
                         'type' => Form::INPUT_CHECKBOX,
                         'label' => $gdprRegister,
                     ],             
                 ],                 
             ],                     
         ]
     ]); 
    ?>

    Expected behavior and actual behavior

    I expect a label to be shown correctly, within a label tag. What I see (see screenshot) is the label's title, without label tags, but with {beginLabel} and {endLabel} in it. Checkboxes without a label option get rendered correctly.

schermafbeelding 2018-09-17 om 15 34 48

--- Did you help close this issue? Go claim the **[$25 bounty](https://www.bountysource.com/issues/63629574-for-checkbox-labels-with-label-option-present-beginlabel-and-endlabel-do-not-get-rendered?utm_campaign=plugin&utm_content=tracker%2F8180036&utm_medium=issues&utm_source=github)** on [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F8180036&utm_medium=issues&utm_source=github).
nilsenpaul commented 6 years ago

Then I thought, just put the content in the model's attributeLabels, but that gets encoded by default by ActiveField.php, and it contains a link. So, I really need this label option.

kartik-v commented 6 years ago

Resolved via updated enhancement commit.