aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/forms/CheckboxCollectionInput.php
blob: 7859b9ac6b52de6c74e6bb784340495b9496e4a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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();
    }
}