Hello,
I have something like this in my form:
// submit
$this->add([
'type' => \Laminas\Form\Element\Submit::class,
'name' => 'submit',
'attributes' => [
'value' => 'Send',
'class' => 'btn btn-sm'
]
]);
Is it possible to add an icon (span with attributes) or an img image with attributes to the submit element? Just additional controlled html elements?
Thanks.
Can you provide the desired HTML output?
Example:
$form->add(
[
'name' => 'send',
'type' => Laminas\Form\Element\Button::class,
'attributes' => [
'class' => 'btn btn-primary',
'type' => 'submit',
],
'options' => [
'label' => '<i class="fas fa-save"></i>Save',
'label_options' => [
'disable_html_escape' => true,
],
],
]
);
There is another option:
<?= $this->formButton()->openTag($element) ?>
<i class="fas fa-save"></i> <?= $element->getLabel() ?>
<?= $this->formButton()->closeTag() ?>
Thank you very much for your help 