aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/forms/CheckboxCollectionInput.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/classes/forms/CheckboxCollectionInput.php')
-rw-r--r--lib/classes/forms/CheckboxCollectionInput.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/classes/forms/CheckboxCollectionInput.php b/lib/classes/forms/CheckboxCollectionInput.php
new file mode 100644
index 0000000..7859b9a
--- /dev/null
+++ b/lib/classes/forms/CheckboxCollectionInput.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Studip\Forms;
+
+class CheckboxCollectionInput extends Input
+{
+ public function render()
+ {
+ $template = $GLOBALS['template_factory']->open('forms/checkbox_collection_input');
+ $template->title = $this->title;
+ $template->name = $this->name;
+ $template->selected = $this->value;
+ $template->required = $this->required;
+
+ $template->collapsable = $this->attributes['collapsable'] ?? false;
+ if (isset($this->attributes['collapsable'])) {
+ unset($this->attributes['collapsable']);
+ }
+ $options = $this->extractOptionsFromAttributes($this->attributes);
+
+ $template->attributes = arrayToHtmlAttributes($this->attributes);
+ $template->options = $options;
+ return $template->render();
+ }
+}