From 2f7eccf84a9613591453c4eb000a4411b75695db Mon Sep 17 00:00:00 2001 From: Dalibor Korpar Date: Thu, 18 Jan 2024 10:27:59 +0100 Subject: [PATCH] addFloat support --- src/Traits/BootstrapContainerTrait.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Traits/BootstrapContainerTrait.php b/src/Traits/BootstrapContainerTrait.php index 4808ab2..36e9a36 100644 --- a/src/Traits/BootstrapContainerTrait.php +++ b/src/Traits/BootstrapContainerTrait.php @@ -154,6 +154,20 @@ public function addInteger(string $name, $label = null): NetteTextInput ->addRule(Form::INTEGER); } + /** + * @param string|Html|null $label + * @return TextInput + */ + public function addFloat(string $name, $label = null): NetteTextInput + { + + return $this->addText($name, $label) + ->setNullable(BootstrapForm::$allwaysUseNullable) + ->setHtmlType('number') + ->setHtmlAttribute('step', 'any') + ->addRule(Form::Float); + } + /** * @param string|Html|null $label * @param string[]|null $items