From 1adb198427f333f508e23c7c3d13b4dcf07a278f Mon Sep 17 00:00:00 2001 From: Sander Hagenaars Date: Mon, 19 Dec 2016 15:32:41 +0100 Subject: [PATCH] show template thumbnails correctly again --- code/dataobjects/Block.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/dataobjects/Block.php b/code/dataobjects/Block.php index 9b4f026..c1540ed 100644 --- a/code/dataobjects/Block.php +++ b/code/dataobjects/Block.php @@ -54,6 +54,16 @@ class Block extends DataObject "RedirectionType" => "Internal" ); + private static $casting = array( + 'createStringAsHTML' => 'HTMLText' + ); + + public function createStringAsHTML($html){ + $casted = HTMLText::create(); + $casted->setValue($html); + return $casted; + } + public function populateDefaults() { $this->Template = $this->class; @@ -177,7 +187,7 @@ public function getCMSFields() // Is there a template thumbnail $thumbnail = (file_exists($src . $name . '.png') ? '' : ''); // TODO: Perhaps just add blank as alt for image, no need to check for existance? $html = '
' . $thumbnail . '
' . $name . ''; - $optionset[$name] = $html; + $optionset[$name] = $this->createStringAsHTML($html); } $tplField = OptionsetField::create(