Skip to content

Commit 7323489

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

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
@@ -278,6 +278,10 @@ public function addComponent(
278278
?string $insertBefore = null,
279279
): static
280280
{
281+
if (!$component instanceof Control && !$component instanceof self) {
282+
throw new Nette\InvalidStateException("Component '$name' of type " . get_debug_type($component) . ' is not intended to be used in the form.');
283+
}
284+
281285
parent::addComponent($component, $name, $insertBefore);
282286
$this->currentGroup?->add($component);
283287
return $this;

0 commit comments

Comments
 (0)