public static function activeRadioButton($model, $attribute, $htmlOptions = array())
{
$label = TbArray::popValue('label', $htmlOptions, false);
$labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
$input = parent::activeRadioButton($model, $attribute, $htmlOptions);
if (TbArray::popValue('useContainer', $htmlOptions, false)) {
return self::tag('div', array('class' => 'radio'), self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions));
} else {
return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
}
}
public function testActiveRadioButton() { $I = $this->codeGuy; $html = TbHtml::activeRadioButton(new Dummy(), 'radio', array('class' => 'input', 'label' => 'Label text')); $body = $I->createNode($html, 'body'); $hidden = $body->filter('input[type=hidden]'); $I->seeNodeAttributes($hidden, array('id' => 'ytDummy_radio', 'name' => 'Dummy[radio]', 'value' => '0')); $label = $body->filter('label'); $I->seeNodeCssClass($label, 'radio'); $radio = $label->filter('input[type=radio]'); $I->seeNodeAttributes($radio, array('class' => 'input', 'checked' => 'checked', 'id' => 'Dummy_radio', 'name' => 'Dummy[radio]', 'value' => '1')); $I->seeNodePattern($label, '/> Label text$/'); }