Skip to content

Commit 5232a21

Browse files
committed
Container: only Control/Container can be added to form (BC break)
1 parent 42ea967 commit 5232a21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Forms/Container.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ public function addComponent(
274274
?string $insertBefore = null,
275275
): static
276276
{
277+
if (!$component instanceof Control && !$component instanceof self) {
278+
throw new Nette\InvalidStateException("Component '$name' of type " . get_debug_type($component) . ' is not intended to be used in the form.');
279+
}
280+
277281
parent::addComponent($component, $name, $insertBefore);
278282
$this->currentGroup?->add($component);
279283
return $this;

0 commit comments

Comments
 (0)