ZF2 表单中的按钮内容 [英] Button content in ZF2 forms
本文介绍了ZF2 表单中的按钮内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编辑 Button 元素(ZF2 表单)的按钮内容?我可以设置标签,但我想在其中插入一些 html 代码.
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(array(
'type' => 'Button',
'name' => 'submit',
'options' => array(
'label' => 'Modifica',
),
'attributes' => array(
'type' => 'submit',
'class' => 'btn btn-warning'
)
));
谢谢
推荐答案
您可以简单地使用 disable_html_escape 标签的选项.它对我有用.
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' => '<i class="icon icon-foo"></i> Submit',
'label_options' => array(
'disable_html_escape' => true,
)
),
'attributes' => array(
'type' => 'submit',
'class' => 'btn btn-success'
)
));
这篇关于ZF2 表单中的按钮内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文