From 4db73fdb95679ce1cb24bbc4e271f0c426b68d17 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 7 Oct 2017 17:22:54 +0200 Subject: [PATCH] TemplateChoiceForm: add min_required, max_allowed fixes #1214 --- .../forms/IcingaTemplateChoiceForm.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/application/forms/IcingaTemplateChoiceForm.php b/application/forms/IcingaTemplateChoiceForm.php index a0b33b0e..c3388fbb 100644 --- a/application/forms/IcingaTemplateChoiceForm.php +++ b/application/forms/IcingaTemplateChoiceForm.php @@ -69,6 +69,28 @@ class IcingaTemplateChoiceForm extends DirectorObjectForm 'multiOptions' => $this->fetchUnboundTemplates() )); + $this->addElement('text', 'min_required', array( + 'label' => $this->translate('Minimum required'), + 'description' => $this->translate( + 'Choosing this many options will be mandatory for this Choice.' + . ' Setting this to zero will leave this Choice optional, setting' + . ' it to one results in a "required" Choice. You can use higher' + . ' numbers to enforce multiple options, this Choice will then turn' + . ' into a multi-selection element.' + ), + 'value' => 0, + )); + + $this->addElement('text', 'max_allowed', array( + 'label' => $this->translate('Allowed maximum'), + 'description' => $this->translate( + 'It will not be allowed to choose more than this many options.' + . ' Setting it to one (1) will result in a drop-down box, a' + . ' higher number will turn this into a multi-selection element.' + ), + 'value' => 1, + )); + $this->setButtons(); }