crisu83 / yiistrap

Twitter Bootstrap for the Yii PHP framework.
http://www.getyiistrap.com
BSD 3-Clause "New" or "Revised" License
286 stars 176 forks source link

Rewrite the modal widget #148

Open crisu83 opened 10 years ago

sganz commented 10 years ago

I was just testing this out and found that it works only if you have 'buttonOptions' defined with an array. So it will only work IF you have a default button created with the buttonOptions.

<?php $this->widget('bootstrap.widgets.TbModal', array(
    'id' => 'myModal',
    'header' => 'Modal Heading',
    'buttonOptions' => array('label'=>'Click Me to Open'),
    'remote' =>'/',
    'footer' => array(
        TbHtml::button('Save Changes', array('data-dismiss' => 'modal', 'color' => TbHtml::BUTTON_COLOR_DANGER)),
        TbHtml::button('Close', array('data-dismiss' => 'modal')),
     ),
));  ?>

Seems like it should be OK to not have a button and still generate the correct code for remote content. In the code it looks like it will only adds the option "data-remote" in the renderButton() code but might need to removed from that and go into the $htmlOptions in the init() method. Maybe way off as I'm just poking around in the code, not totally sure how it was intended to work ;)

Thanks for a great extension as well!

Sandy

crisu83 commented 10 years ago

Alright, in that case this is a bug. I won't have time to look at it now but feel free to make a PR to fix this.