Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • DatalessField
  • HeaderField
  • HiddenField
  • LabelField
  • LiteralField
  • ToggleField
 1 <?php
 2 /**
 3  * This field lets you put an arbitrary piece of HTML into your forms.
 4  * 
 5  * @package forms
 6  * @subpackage fields-dataless
 7  */
 8 class LiteralField extends DatalessField {
 9     
10     /**
11      * @var string $content
12      */
13     protected $content;
14     
15     function __construct($name, $content) {
16         $this->content = $content;
17         
18         parent::__construct($name);
19     }
20     
21     function Field() {
22         $attributes = array(
23             'type' => 'literal',
24         );
25         return $this->createTag('span', $attributes, is_object($this->content) ? $this->content->forTemplate() : $this->content);
26     }
27   
28     /**
29      * Sets the content of this field to a new value
30      * @param string $content
31      */
32     function setContent($content) {
33         $this->content = $content;
34     }
35     
36     /**
37      * @return string
38      */
39     function getContent() {
40         return $this->content;
41     }
42     
43     /**
44      * Synonym of {@link setContent()} so that LiteralField is more compatible with other field types.
45      */
46     function setValue($value) {
47         return $this->setContent($value);
48     }
49 
50     function performReadonlyTransformation() {
51         $clone = clone $this;
52         $clone->setReadonly(true);
53         return $clone;
54     }
55 }
56 
57 ?>
[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. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0