Skip to content

Commit

Permalink
Remove setHtml from buttons which don't need it
Browse files Browse the repository at this point in the history
Using `->setHtml()` without HTML markup just for translation is useless
overkill. Setting caption directly with translation string is enough
Form has translator attached (with `$form->setTranslator($this->translator);`
and caption is automatically translated. See https://github.com/nette/forms/blob/4a70d32a3b40d096a4ae96410971dfde19e2456d/src/Forms/Controls/Button.php#L62
  • Loading branch information
markoph committed Mar 30, 2022
1 parent d180912 commit 650e02c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Forms/UserInvoiceFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public function create(ActiveRow $payment): Form
->getControlPrototype()
->setName('button')
->setAttribute('class', 'btn btn-success')
->setAttribute('style', 'float: right')
->setHtml($this->translator->translate('invoices.form.invoice.label.save'));
->setAttribute('style', 'float: right');

$defaults = [];

Expand Down

0 comments on commit 650e02c

Please sign in to comment.