aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/DataFieldTextmarkupEntry.class.php
blob: 50115b94f2739b232211df537627ad3b82c47422 (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
31
32
33
34
35
<?php

/**
 * @author  Elmar Ludwig <elmar.ludwig@uos.de>
 * @license GPL2 or any later version
 */
class DataFieldTextmarkupEntry extends DataFieldTextareaEntry
{
    protected $template = 'textmarkup.php';

    /**
     * Sets the value from a post request
     *
     * @param mixed $submitted_value The value from request
     */
    public function setValueFromSubmit($submitted_value)
    {
        $this->setValue(Studip\Markup::purifyHtml($submitted_value));
    }

    /**
     * Returns the display/rendered value of this datafield
     *
     * @param bool $entities Should html entities be encoded (defaults to true)
     * @return String containg the rendered value
     */
    public function getDisplayValue($entities = true)
    {
        if ($entities) {
            return formatReady($this->getValue());
        }

        return $this->getValue();
    }
}