control->type = 'checkbox'; $this->container = Html::el(); $this->setOption('type', 'checkbox'); } /** * Sets control's value. * @return static * @internal */ public function setValue($value) { if (!\is_scalar($value) && $value !== null) { throw new \Packetery\Nette\InvalidArgumentException(\sprintf("Value must be scalar or null, %s given in field '%s'.", \gettype($value), $this->name)); } $this->value = (bool) $value; return $this; } public function isFilled() : bool { return $this->getValue() !== \false; // back compatibility } public function getControl() : Html { return $this->container->setHtml($this->getLabelPart()->insert(0, $this->getControlPart())); } /** * Bypasses label generation. */ public function getLabel($caption = null) { return null; } public function getControlPart() : Html { return parent::getControl()->checked($this->value); } public function getLabelPart() : Html { return parent::getLabel(); } /** * Returns container HTML element template. */ public function getContainerPrototype() : Html { return $this->container; } /** @deprecated use getContainerPrototype() */ public function getSeparatorPrototype() : Html { return $this->container; } }