diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/classes/DataFieldTextmarkupi18nEntry.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/classes/DataFieldTextmarkupi18nEntry.php')
| -rw-r--r-- | lib/classes/DataFieldTextmarkupi18nEntry.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/classes/DataFieldTextmarkupi18nEntry.php b/lib/classes/DataFieldTextmarkupi18nEntry.php new file mode 100644 index 0000000..0b3d7e6 --- /dev/null +++ b/lib/classes/DataFieldTextmarkupi18nEntry.php @@ -0,0 +1,47 @@ +<?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(); + } +} |
