Button content in ZF2 forms

前端 未结 3 359
忘了有多久
忘了有多久 2021-01-14 15:53

How to edit the button content of a Button element (of a ZF2 form)? I can set a label, but i would like to insert some html code inside it.

    $this->add         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 16:41

    You can simply use the disable_html_escape label's option. It works for me.

    $this->add(array(
            'type' => 'Button',
            'name' => 'submit',
            'options' => array(
                'label' => ' Submit',
                'label_options' => array(
                    'disable_html_escape' => true,
                )
            ),
            'attributes' => array(
                'type'  => 'submit',
                'class' => 'btn btn-success'
             )
        ));
    

提交回复
热议问题