Skip to content
Snippets Groups Projects
Forked from Stud.IP / Stud.IP
458 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
DataFieldTextmarkupi18nEntry.php 1.40 KiB
<?php
/**
 * DataFieldTextmarkup18nEntry.php
 * Representation of datafields of type textmarkup with i18n support.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * @author      Peter Thienel <pthienel@data-quest.de>
 * @copyright   2017 Stud.IP Core-Group
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 * @category    Stud.IP
 * @since       4.1
 *
 */
class DataFieldTextmarkupi18nEntry extends DataFieldTextareai18nEntry
{
    protected $template = 'textmarkupi18n.php';

    /**
     * Sets the value from a post request
     *
     * @param mixed $submitted_value The value from request
     */
    public function setValueFromSubmit($submitted_value)
    {
        array_walk($submitted_value, 'Studip\Markup::purifyHtml');
        parent::setValueFromSubmit($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();
    }
}