Version: current

     1 <?php
     2
     3 /**
     4  * Editable Literal Field. A literal field is just a blank slate where
     5  * you can add your own HTML / Images / Flash
     6  *
     7  * @package userforms
     8  */
     9
    10 class EditableLiteralField extends EditableFormField {
    11
    12     static $singular_name = 'HTML Block';
    13
    14     static $plural_name = 'HTML Blocks';
    15
    16     function getFieldConfiguration() {
    17         return new FieldSet(
    18             new TextareaField(
    19                 $this->getSettingName('Content'),
    20                 "HTML", 4, 20, $this->getSetting('Content')
    21             ),
    22             new CheckboxField(
    23                 $this->getSettingName('HideFromReports'),
    24                 _t('EditableLiteralField.HIDEFROMREPORT', 'Hide from reports?'),
    25                 $this->getSetting('HideFromReports')
    26             )
    27         );
    28     }
    29
    30     function getFormField() {
    31         return new LiteralField("LiteralField[$this->ID]",
    32             "<div id='$this->Name' class='field text'>
    33                 <label class='left'>$this->Title</label>
    34                 <div class='middleColumn literalFieldArea'>". $this->getSetting('Content') ."</div>".
    35             "</div>"
    36         );
    37     }
    38
    39     function showInReports() {
    40         return (!$this->getSetting('HideFromReports'));
    41     }
    42 }

[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. -