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

about the button config when use form widget #311

Closed hzgoin closed 7 years ago

hzgoin commented 7 years ago

the usage in http://www.getyiistrap.com/site/widgets#forms 'buttons' => array( 'submit' => array( 'type' => TbHtml::BUTTON_TYPE_SUBMIT, 'label' => 'Submit', 'attributes' => array('color' => TbHtml::BUTTON_COLOR_PRIMARY), ),

code in TbFormButtonElement->render will always perform the else process when configure the submit button with type TbHtml::....or i use this incorrect?

public static $coreTypes = array( 'htmlButton' => TbHtml::BUTTON_TYPE_HTML, 'htmlReset' => TbHtml::BUTTON_TYPE_RESET, 'htmlSubmit' => TbHtml::BUTTON_TYPE_SUBMIT, 'submit' => TbHtml::BUTTON_TYPE_INPUTSUBMIT, 'button' => TbHtml::BUTTON_TYPE_INPUTBUTTON, 'image' => TbHtml::BUTTON_TYPE_IMAGE, 'reset' => TbHtml::BUTTON_TYPE_RESET, 'link' => TbHtml::BUTTON_TYPE_LINK, 'ajaxLink' => TbHtml::BUTTON_TYPE_AJAXLINK, 'ajaxButton' => TbHtml::BUTTON_TYPE_AJAXBUTTON, );

`public function render()
{
    $attributes = $this->attributes;
    $attributes['name'] = $this->name;

    if (isset(self::$coreTypes[$this->type])) {
        $type = self::$coreTypes[$this->type];
        return TbHtml::btn($type, $this->label, $attributes);
    } else {
        return $this->getParent()->getOwner()->widget($this->type, $attributes, true);
    }
}`