diff --git a/src/Forms/Rendering/DefaultFormRenderer.php b/src/Forms/Rendering/DefaultFormRenderer.php index f1685bd64..64da5e47c 100644 --- a/src/Forms/Rendering/DefaultFormRenderer.php +++ b/src/Forms/Rendering/DefaultFormRenderer.php @@ -418,7 +418,7 @@ public function renderPairMulti(array $controls): string } $control->setOption('rendered', true); - $el = $control->getControl(); + $el = $this->renderControlElement($control); if ($el instanceof Html) { if ($el->getName() === 'input') { $el->class($this->getValue("control .$el->type"), true); @@ -443,7 +443,7 @@ public function renderPairMulti(array $controls): string public function renderLabel(Nette\Forms\Control $control): Html { $suffix = $this->getValue('label suffix') . ($control->isRequired() ? $this->getValue('label requiredsuffix') : ''); - $label = $control->getLabel(); + $label = $this->renderLabelElement($control); if ($label instanceof Html) { $label->addHtml($suffix); if ($control->isRequired()) { @@ -494,7 +494,7 @@ public function renderControl(Nette\Forms\Control $control): Html $els = $errors = []; renderControl: $control->setOption('rendered', true); - $el = $control->getControl(); + $el = $this->renderControlElement($control); if ($el instanceof Html) { if ($el->getName() === 'input') { $el->class($this->getValue("control .$el->type"), true); @@ -516,6 +516,20 @@ public function renderControl(Nette\Forms\Control $control): Html } + /** @return string|Html|null */ + protected function renderLabelElement(Nette\Forms\Control $control) + { + return $control->getLabel(); + } + + + /** @return string|Html */ + protected function renderControlElement(Nette\Forms\Control $control) + { + return $control->getControl(); + } + + public function getWrapper(string $name): Html { $data = $this->getValue($name);