We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3753d36 commit 02ad720Copy full SHA for 02ad720
src/Forms/Controls/BaseControl.php
@@ -253,8 +253,11 @@ public function getLabel(string|Stringable $caption = null): Html|string|null
253
$label = clone $this->label;
254
$label->for = $this->getHtmlId();
255
$caption ??= $this->caption;
256
- $translator = $this->getForm()->getTranslator();
257
- $label->setText($translator && !$caption instanceof Nette\HtmlStringable ? $translator->translate($caption) : $caption);
+ if (!$caption instanceof Nette\HtmlStringable) {
+ $translator = $this->getForm()->getTranslator();
258
+ $caption = $translator ? $translator->translate($caption) : (string) $caption;
259
+ }
260
+ $label->setText($caption);
261
return $label;
262
}
263
0 commit comments