Skip to content

Commit f590c7f

Browse files
committed
Container: only Control/Container can be added to form (BC break)
1 parent fe012c7 commit f590c7f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Forms/Container.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ public function addComponent(
290290
?string $insertBefore = null,
291291
): static
292292
{
293+
if (!$component instanceof Control && !$component instanceof self) {
294+
throw new Nette\InvalidStateException("Component '$name' of type " . get_debug_type($component) . ' is not intended to be used in the form.');
295+
}
296+
293297
parent::addComponent($component, $name, $insertBefore);
294298
$this->currentGroup?->add($component);
295299
return $this;

0 commit comments

Comments
 (0)