Version: current

# Class Text

Represents a long text field.

  Object
  ViewableData implements IteratorAggregate
  DBField
  StringField
  Text

### Direct known subclasses

`HTMLText`

Package: sapphire\model
Located at sapphire/core/model/fieldtypes/Text.php

## Methods summary

`public` | # `requireField( )` (non-PHPdoc) (non-PHPdoc) #### See ``DBField::requireField()``
`public string` | # `LimitWordCount( integer $numWords = 26, string $add = '...' )` Limit this field's content by a number of words. CAUTION: This is not XML safe. Please use `Text::LimitWordCountXML()` instead. Limit this field's content by a number of words. CAUTION: This is not XML safe. Please use `Text::LimitWordCountXML()` instead. #### Parameters $numWords int $numWords Number of words to limit by $add string $add Ellipsis to add to the end of truncated string #### Returns `string` string
`public string` | # `NoHTML( )` Return the value of the field stripped of html tags Return the value of the field stripped of html tags #### Returns `string` string
`public string` | # `EscapeXML( )` Return the value of the field with XML tags escaped. Return the value of the field with XML tags escaped. #### Returns `string` string
`public string` | # `AbsoluteLinks( )` Return the value of the field with relative links converted to absolute urls. Return the value of the field with relative links converted to absolute urls. #### Returns `string` string
`public string` | # `LimitCharacters( integer $limit = 20, string $add = "..." )` Limit this field's content by a number of characters. CAUTION: Does not take into account HTML tags, so it has the potential to return malformed HTML. Limit this field's content by a number of characters. CAUTION: Does not take into account HTML tags, so it has the potential to return malformed HTML. #### Parameters $limit int $limit Number of characters to limit by $add string $add Ellipsis to add to the end of truncated string #### Returns `string` string
`public string` | # `LimitWordCountXML( integer $numWords = 26, string $add = '...' )` Limit the number of words of the current field's content. This is XML safe, so characters like & are converted to & Limit the number of words of the current field's content. This is XML safe, so characters like & are converted to & #### Parameters $numWords int $numWords Number of words to limit by $add string $add Ellipsis to add to the end of truncated string #### Returns `string` string
`public` | # `LimitSentences( integer $sentCount = 2 )` Limit sentences, can be controlled by passing an integer. Limit sentences, can be controlled by passing an integer. #### Parameters $sentCount int $sentCount The amount of sentences you want.
`public` | # `FirstSentence( )` Caution: Not XML/HTML-safe - does not respect closing tags. Caution: Not XML/HTML-safe - does not respect closing tags.
`public` | # `Summary( mixed $maxWords = 50 )` Caution: Not XML/HTML-safe - does not respect closing tags. Caution: Not XML/HTML-safe - does not respect closing tags.
`public` | # `BigSummary( mixed $maxWords = 50, mixed $plain = 1 )` Performs the same function as the big summary, but doesnt trim new paragraphs off data. Caution: Not XML/HTML-safe - does not respect closing tags. Performs the same function as the big summary, but doesnt trim new paragraphs off data. Caution: Not XML/HTML-safe - does not respect closing tags.
`public` | # `FirstParagraph( mixed $plain = 1 )` Caution: Not XML/HTML-safe - does not respect closing tags. Caution: Not XML/HTML-safe - does not respect closing tags.
`public string` | # `ContextSummary( integer $characters = 500, boolean $string = false, boolean $striphtml = true, boolean $highlight = true )` Perform context searching to give some context to searches, optionally highlighting the search term. Perform context searching to give some context to searches, optionally highlighting the search term. #### Parameters $characters int $characters Number of characters in the summary $string boolean $string Supplied string ("keywords") $striphtml boolean $striphtml Strip HTML? $highlight boolean $highlight Add a highlight <span> element around search query? #### Returns `string` string
`public string` | # `Parse( mixed $parser = "TextParser" )` Allows a sub-class of TextParser to be rendered. Allows a sub-class of TextParser to be rendered. #### Returns `string` string #### See TextParser for implementation details.
`public `FormField`` | # `scaffoldFormField( string $title = null, mixed $params = null )` (non-PHPdoc) (non-PHPdoc) #### Parameters $title string $title Optional. Localized title of the generated instance $params #### Returns ``FormField`` FormField #### See ``DBField::scaffoldFormField()`` #### Overrides `DBField::scaffoldFormField`
`public `FormField`` | # `scaffoldSearchField( string $title = null, mixed $params = null )` (non-PHPdoc) (non-PHPdoc) #### Parameters $title string $title Optional. Localized title of the generated instance $params #### Returns ``FormField`` FormField #### See ``DBField::scaffoldSearchField()`` #### Overrides `DBField::scaffoldSearchField`

### Methods inherited from StringField

`Lower()`, `Upper()`, `__construct()`, `getNullifyEmpty()`, `hasValue()`, `prepValueForDB()`, `setNullifyEmpty()`, `setOptions()`

### Methods inherited from DBField

`ATT()`, `HTML()`, `HTMLATT()`, `JS()`, `LowerCase()`, `RAW()`, `RAWURLATT()`, `URLATT()`, `UpperCase()`, `XML()`, `addToQuery()`, `create()`, `debug()`, `defaultSearchFilter()`, `exists()`, `forTemplate()`, `getName()`, `getValue()`, `nullValue()`, `saveInto()`, `setName()`, `setTable()`, `setValue()`, `writeToManipulation()`

### 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()`, `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()`, `createMethod()`, `create_from_string()`, `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

`public static array` | $casting | # An array of objects to cast certain fields to. This is set up as an array in the format: An array of objects to cast certain fields to. This is set up as an array in the format:
    public static $casting = array (
        'FieldName' => 'ClassToCastTo(Arguments)'
    );

### Properties inherited from StringField

`$nullifyEmpty`

### Properties inherited from DBField

`$arrayValue`, `$defaultVal`, `$default_search_filter_class`, `$escape_type`, `$name`, `$tableName`, `$value`

### Properties inherited from ViewableData

`$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. -