Skip to content

Commit 3dd3d66

Browse files
committed
type fix
1 parent 7311c95 commit 3dd3d66

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Forms/Controls/BaseControl.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,11 @@ public function getLabel(string|Stringable $caption = null): Html|string|null
253253
$label = clone $this->label;
254254
$label->for = $this->getHtmlId();
255255
$caption ??= $this->caption;
256-
$translator = $this->getForm()->getTranslator();
257-
$label->setText($translator && !$caption instanceof Nette\HtmlStringable ? $translator->translate($caption) : $caption);
256+
if (!$caption instanceof Nette\HtmlStringable) {
257+
$translator = $this->getForm()->getTranslator();
258+
$caption = $translator ? $translator->translate($caption) : (string) $caption;
259+
}
260+
$label->setText($caption);
258261
return $label;
259262
}
260263

0 commit comments

Comments
 (0)