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
If all you need is just an icon, using css is a much more simpler option, in form file you just add a custom css class to your button, and then in your style sheets add the icon to the class using before and content like this:
$this->add(array(
'type' => 'Button',
'name' => 'submit',
'options' => array(
'label' => 'Modifica',
),
'attributes' => array(
'type' => 'submit',
'class' => 'btn btn-warning custom-btn-with-icon'
)
));
then in css:
.custom-btn-with-icon:before {
content: '\uxf005'; // this is the unicode of the custom-char you need for your icon
font-family: 'fontAwesome'; // and this is the icon font of your project
}