public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);

        $this->pluginOptions['id'] = $this->htmlOptions['id'] . '_switch';
        echo CHtml::openTag('div', $this->pluginOptions);
        if ($this->hasModel()) {
            echo $this->inputType == 'radio'
                ? CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions)
                : CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions);
        } else {
            echo $this->inputType == 'radio'
                ? CHtml::radioButton($this->name, $this->value, $this->htmlOptions)
                : CHtml::checkBox($this->name, $this->value, $this->htmlOptions);
        }
        echo CHtml::closeTag('div');
    }
public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);

        $this->pluginOptions['id'] = $this->htmlOptions['id'] . '_switch';
        echo CHtml::openTag('div', $this->pluginOptions);
        if ($this->hasModel()) {
            echo $this->inputType == 'radio'
                ? CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions)
                : CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions);
        } else {
            echo $this->inputType == 'radio'
                ? CHtml::radioButton($this->name, $this->value, $this->htmlOptions)
                : CHtml::checkBox($this->name, $this->value, $this->htmlOptions);
        }
        echo CHtml::closeTag('div');
    }
public function renderField ( ) { list ( $ name , $ id ) = $ this -> resolveNameID ( ) ; TbArray :: defaultValue ( 'id' , $ id , $ this -> htmlOptions ) ; TbArray :: defaultValue ( 'name' , $ name , $ this -> htmlOptions ) ; $ this -> pluginOptions [ 'id' ] = $ this -> htmlOptions [ 'id' ] . '_switch' ; echo CHtml :: openTag ( 'div' , $ this -> pluginOptions ) ; if ( $ this -> hasModel ( ) ) { echo $ this -> inputType == 'radio' ? CHtml :: activeRadioButton ( $ this -> model , $ this -> attribute , $ this -> htmlOptions ) : CHtml :: activeCheckBox ( $ this -> model , $ this -> attribute , $ this -> htmlOptions ) ; } else { echo $ this -> inputType == 'radio' ? CHtml :: radioButton ( $ this -> name , $ this -> value , $ this -> htmlOptions ) : CHtml :: checkBox ( $ this -> name , $ this -> value , $ this -> htmlOptions ) ; } echo CHtml :: closeTag ( 'div' ) ; }
Renders the typeahead field
Renders the typeahead field