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 acb777a commit e510fe6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Forms/GiftSubscriptionAddressFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ public function create(ActiveRow $payment): Form
->getControlPrototype()
->setName('button')
->setAttribute('class', 'btn btn-success')
->setAttribute('style', 'float: right')
->setHtml($this->translator->translate('gifts.components.gift_subscription_address.form.label.save'));
->setAttribute('style', 'float: right');

$form->onSuccess[] = [$this, 'formSucceeded'];

Expand Down

0 comments on commit e510fe6

Please sign in to comment.