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

BS3: Fix: mark checked button in button group as active #301

Closed marcovtwout closed 9 years ago

marcovtwout commented 9 years ago

Fix: mark checked button in button group as active, consistent to official bootstrap example.

Docs: http://getbootstrap.com/javascript/#buttons-checkbox-radio Quote: For preselected options, you must add the .active class to the input's label yourself.

Example code:

    $buttons = array();
    $buttons[] = array('label' => 'Foo', 'checked' => true);
    $buttons[] = array('label' => 'Bar');
    echo TbHtml::buttonGroup($buttons, array('toggle' => TbHtml::BUTTON_TOGGLE_RADIO));
crisu83 commented 9 years ago

Hey @marcovtwout could you put the assignment of the $checked variable inside the if statement and we're good to go. I don't know why Scrutinizer timed out.

marcovtwout commented 9 years ago

I moved $checked = further down to the place where it is used. Where exactly do you suggest it would be moved? Note that $checked still needs to be assigned and passed to self::checkBox or self:radioButton.

marcovtwout commented 9 years ago

@crisu83 shall I merge this myself?

crisu83 commented 9 years ago

I can merge it.