Skip to content

Commit

Permalink
Container: only Control/Container can be added to form (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Oct 27, 2021
1 parent 5f3ce77 commit 0f0c770
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Forms/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ public function addComponent(
?string $name,
string $insertBefore = null,
): static {
if (!$component instanceof Control && !$component instanceof self) {
throw new Nette\InvalidStateException("Component '$name' of type " . gettype($component) . ' is not intended to be used in the form.');
}
parent::addComponent($component, $name, $insertBefore);
if ($this->currentGroup !== null) {
$this->currentGroup->add($component);
Expand Down

0 comments on commit 0f0c770

Please sign in to comment.