Version: current

     1 <?php
     2 /**
     3  * Represents a short text field that is intended to contain HTML content.
     4  *
     5  * This behaves similarly to Varchar, but the template processor won't escape any HTML content within it.
     6  * @package sapphire
     7  * @subpackage model
     8  */
     9 class HTMLVarchar extends Varchar {
    10
    11     public static $escape_type = 'xml';
    12
    13     public function forTemplate() {
    14         return ShortcodeParser::get_active()->parse($this->value);
    15     }
    16
    17     public function hasValue() {
    18         return parent::hasValue() && $this->value != '<p></p>';
    19     }
    20
    21     public function scaffoldFormField($title = null, $params = null) {
    22         return new HtmlEditorField($this->name, $title, 1);
    23     }
    24
    25     public function scaffoldSearchField($title = null) {
    26         return new TextField($this->name, $title);
    27     }
    28
    29 }
    30
    31 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -