Skip to content

Commit 2f562c1

Browse files
committed
Container: only Control/Container can be added to form (BC break)
1 parent 7d8ce0a commit 2f562c1

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

0 commit comments

Comments
 (0)