Version: current

# Class LiteralField

This field lets you put an arbitrary piece of HTML into your forms.

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  FormField
  DatalessField
  LiteralField

Package: forms\fields-dataless
Located at sapphire/forms/LiteralField.php

## Methods summary

`public` | # `__construct( string $name, string $content )` #### Parameters $name string $name $content string $title The label itslef #### Overrides `DatalessField::__construct`
`public` | # `Field( )` Returns the form field - used by templates. Although FieldHolder is generally what is inserted into templates, all of the field holder templates make use of $Field. It's expected that FieldHolder will give you the "complete" representation of the field on the form, whereas Field will give you the core editing widget, such as an input tag. Returns the form field - used by templates. Although FieldHolder is generally what is inserted into templates, all of the field holder templates make use of $Field. It's expected that FieldHolder will give you the "complete" representation of the field on the form, whereas Field will give you the core editing widget, such as an input tag. Our base FormField class just returns a span containing the value. This should be overridden! #### Overrides `FormField::Field`
`public` | # `setContent( string $content )` Sets the content of this field to a new value Sets the content of this field to a new value #### Parameters $content string $content
`public string` | # `getContent( )` #### Returns `string` string
`public` | # `setValue( mixed $value )` Synonym of `LiteralField::setContent()` so that LiteralField is more compatible with other field types. Synonym of `LiteralField::setContent()` so that LiteralField is more compatible with other field types. #### Overrides `FormField::setValue`
`public` | # `performReadonlyTransformation( )` Returns a readonly version of this field Returns a readonly version of this field #### Overrides `DatalessField::performReadonlyTransformation`

### Methods inherited from DatalessField

`FieldHolder()`, `SmallFieldHolder()`, `getAllowHTML()`, `hasData()`, `setAllowHTML()`

### Methods inherited from FormField

`LeftTitle()`, `Link()`, `Message()`, `MessageType()`, `Name()`, `Required()`, `RightTitle()`, `Title()`, `Type()`, `Value()`, `addExtraAttribute()`, `addExtraClass()`, `allowHTML5()`, `allow_html5()`, `attrName()`, `attrTitle()`, `attrValue()`, `createTag()`, `dataValue()`, `debug()`, `describe()`, `extraClass()`, `fieldHolderTemplates()`, `fieldTemplates()`, `forTemplate()`, `getCustomValidationMessage()`, `getExtraClasses()`, `getForm()`, `getHTML5Attribute()`, `getTabIndex()`, `getTabIndexHTML()`, `hasClass()`, `id()`, `isComposite()`, `isDisabled()`, `isReadonly()`, `jsValidation()`, `name_to_label()`, `performDisabledTransformation()`, `removeExtraAttribute()`, `removeExtraClass()`, `rootFieldSet()`, `saveInto()`, `securityTokenEnabled()`, `setAutocomplete()`, `setContainerFieldSet()`, `setCustomValidationMessage()`, `setDisabled()`, `setError()`, `setFieldHolderTemplate()`, `setForm()`, `setHTML5Attribute()`, `setLeftTitle()`, `setName()`, `setReadonly()`, `setRightTitle()`, `setSmallFieldHolderTemplate()`, `setTabIndex()`, `setTemplate()`, `setTitle()`, `smallFieldHolderTemplates()`, `transform()`, `useHTML5()`, `use_html5()`, `validate()`

### Methods inherited from RequestHandler

`allowedActions()`, `checkAccessAction()`, `getRequest()`, `handleRequest()`, `hasAction()`, `httpError()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`protected string` | $content | # $content $content

### Properties inherited from DatalessField

`$allowHTML`

### Properties inherited from FormField

`$autocomplete`, `$containerFieldSet`, `$customValidationMessage`, `$description`, `$disabled`, `$dontEscape`, `$extraAttributes`, `$extraClass`, `$extraClasses`, `$fieldHTML5`, `$fieldHolderTemplate`, `$form`, `$html5Attributes`, `$leftTitle`, `$message`, `$messageType`, `$name`, `$possible_autocomplete_values`, `$readonly`, `$rightTitle`, `$smallFieldHolderTemplate`, `$tabIndex`, `$template`, `$title`, `$use_html5`, `$value`

### Properties inherited from RequestHandler

`$allowed_actions`, `$brokenOnConstruct`, `$request`, `$url_handlers`

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

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