Yii-Bootstrap / Yii-Booster Empty Htmloptions Bug

This is invalid. See below for more details.

[s]Either I’m missing something obvious or Yii-Bootstrap / Yii-Booster extensions are somehow clearing (changing) $htmlOptions array used in TbActiveForm::error() and problably in some other places.

First, let’s take a look, how this works when using base classes (CActiveForm).

This is the code in form view:




<?php 

    $validationArray = array

    (

        'hideErrorMessage'=>TRUE,

        'afterValidateAttribute'=>'js:afterValidateAttribute'

    );

?>


<?php echo('<pre>$validationArray = '.print_r($validationArray, TRUE).'</pre>'); ?>


<div class="row">

    ...

    <?php echo($form->error($model, 'name', $validationArray)); ?>

</div>



additional print_r() and die() are added as the first line of CActiveForm::error() function, to compare array that is passed and array that is received.

Running such configured script results in following screen output:




$validationArray = Array

(

    [hideErrorMessage] => 1

    [afterValidateAttribute] => js:afterValidateAttribute

)

 	

$htmlOptions = Array

(

    [hideErrorMessage] => 1

    [afterValidateAttribute] => js:afterValidateAttribute

)



What comes in must comes out, so everything is fine.

Now, take a look, what happens, when using TbActiveForm instead.

This is the view code (quite similar):




<?php 

    $validationArray = array

    (

        'hideErrorMessage'=>TRUE,

        'afterValidateAttribute'=>'js:afterValidateAttribute'

    );

?>


<?php echo('<pre>$validationArray = '.print_r($validationArray, TRUE).'</pre>'); ?>


<?php echo($form->textFieldRow($model, 'name', $htmlOptions + array('prepend'=>'Imię'))); ?>

<?php echo($form->error($model, 'name', $validationArray)); ?>



additional print_r() and die() are added as the first line of TbActiveForm::error() function as well.

And this is the screen output:




$validationArray = Array

(

    [hideErrorMessage] => 1

    [afterValidateAttribute] => js:afterValidateAttribute

)


$htmlOptions = Array

(

)



Can someone explain me, what is going on? Why this array is being cleared and where?[/s]

This is invalid. Missed out, that htmlOptions for particular elements are passed not at first level of array, but rather as subarrays – i.e. errorOptions, prependOptions, labelOptions etc.