FieldtypeTextarea

Stores multi-line text, optionally as HTML/Markup. Extends FieldtypeText.

Value type

string — multi-line text or HTML markup, or empty string '' when blank.

Getting and setting values
// Get
$page->body   // string (formatted when output formatting is on)
$page->getUnformatted('body') // raw value, no Textformatters applied

// Set
$page->body = 'Some <b>HTML</b> content.';
$page->save('body');
Selectors

Supports the same operators as FieldtypeText (fulltext, LIKE, etc.):

$pages->find('body*=keyword');  // fulltext match
$pages->find('body%=keyword');  // LIKE match
$pages->find('body=""');        // no content
Output / markup
// output formatting ON (default in front-end):
echo $page->body;  // Textformatters applied, MarkupQA corrections applied for HTML

// output formatting OFF:
echo $page->getUnformatted('body');  // raw stored value

When contentType is set to HTML, the field automatically corrects href and src attributes at save/load time so that URLs remain valid if the site moves to a different subdirectory or domain.

Notes
  • contentType setting: 0=plain text (default), 1=HTML/Markup, 2=HTML with image management.
  • inputfieldClass setting: the Inputfield used for editing. Common values: InputfieldTextarea (default), InputfieldCKEditor, InputfieldTinyMCE.
  • htmlOptions setting: array of flags for HTML content type — link abstraction, image alt management, removing inaccessible images, lazy loading. Only relevant when contentType >= 1.
  • Database column: mediumtext NOT NULL, fulltext indexed.
  • Compatible fieldtypes: any fieldtype extending FieldtypeText.
API reference: methods, hooks

Properties set to $field that is using this type, acceessed by $field->get('property')

  • contentType (int): Content type of field output using a self::contentType* constant Default:0
  • htmlOptions (array): Options for content-type Markup/HTML using self::html* constants Default:[]
  • inputfieldClass (string): Inputfield class/module name to use for this field Default:InputfieldTextarea

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the FieldtypeTextarea class also inherits all the methods and properties of: FieldtypeText, Fieldtype, WireData and Wire.

Show class?     Show args?       Only hookable?    

Common

NameReturnSummary 
FieldtypeTextarea::configHelper()
FieldtypeTextareaHelper

Get an instance of the FieldtypeTextareaHelper config helper

 
FieldtypeTextarea::exportValue(Page $page, Field $field, $value)
array string

Export value

FieldtypeTextarea::findLinks(Page $page)
PageArray array int

Find abstracted HTML/href attribute Textarea links to given $page

 
FieldtypeTextarea::formatValue($page, $field, $value)
None
FieldtypeTextarea::getConfigInputfields(Field $field)
InputfieldWrapper

Get Inputfields to configure the Field

FieldtypeTextarea::getDatabaseSchema(Field $field)
array

Get database schema used by the Field

 
FieldtypeTextarea::getFieldClass()
string

Get the Field class to use for fields of this type

 
FieldtypeTextarea::getFieldSetups()
array

Get setup options and setup functions for new fields

FieldtypeTextarea::getInputfield(Page $page, Field $field)
Inputfield

Get the Inputfield module that provides input for Field

 
FieldtypeTextarea::importValue(Page $page, Field $field, $value)
array string

Import value

FieldtypeTextarea::loadPageField($page, $field)
None
FieldtypeTextarea::markupQA()
MarkupQA

Get the MarkupQA instance

 
FieldtypeTextarea::markupValue($page, $field)
None
FieldtypeTextarea::sleepValue($page, $field, $value)
None
FieldtypeTextarea::wakeupValue($page, $field, $value)
None

Additional methods and properties

In addition to the methods and properties above, FieldtypeTextarea also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.261