aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/forms/WysiwygInput.php
blob: f2702261129fc63b46c2fbdf01d7c19acae3fe90 (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
26
27
28
29
30
<?php

namespace Studip\Forms;

class WysiwygInput extends Input
{
    public function render()
    {
        $template = $GLOBALS['template_factory']->open('forms/wysiwyg_input');
        $template->title = $this->title;
        $template->name = $this->name;
        $template->value = $this->value;
        $template->id = md5(uniqid());
        $template->required = $this->required;
        $template->attributes = arrayToHtmlAttributes($this->attributes);
        return $template->render();
    }

    public function getRequestValue()
    {
        $value = \Request::get($this->name);
        if (trim($value)) {
            return \Studip\Markup::markAsHtml(
                \Studip\Markup::purifyHtml($value)
            );
        } else {
            return '';
        }
    }
}