The text value encapsulated by this type is
passed as-is to the storage layers, no specialties done, just a string.
Available configuration options:
- int maxlength: The maximum length of the string allowed for this field.
This includes any newlines, which account as at most two characters, depending
on the OS. Set this to 0 (the default) to have unlimited input.
- string output_mode: This option controls how convert_to_html operates. The
default 'specialchars' will just pass the data entered in the field through
htmlspecialchars(). See below for a full option listing.
Available output modes:
- 'html': No conversion is done.
- 'specialchars': The value is run through htmlspecialchars() (the default).
- 'nl2br': The value is run through htmlspecialchars() and nl2br()
- 'midgard_f': Uses the Midgard :f formatter.
- 'midgard_F': Uses the Midgard :F formatter.
- 'markdown': Uses net.nehmer.markdown.
Methods
_on_validate ()
The validation callback ensures that we don't have an array or an object
as a value, which would be wrong.
Returns
boolean
Indicating validity.
convert_from_csv ($source)
convert_from_storage ($source)
validate_allowed_patterns ($fields)
validate_forbidden_patterns ($fields)
Properties
mixed $allowed_patterns
Define array of forbidden patterns in this field
Example:
'type_config' => Array
(
'allowed_patterns' => array
(
array
(
'type' => 'regex',
'pattern' => '%^http://(mydomain|othernicedomain)\.(org|net)%i',
'explanation' => 'Domains other than mydomain.net/org and othernicedomain.net/org are forbidden',
),
),
),
mixed $forbidden_patterns
Define array of forbidden patterns in this field
Example:
'type_config' => Array
(
'output_mode' => 'markdown',
'forbidden_patterns' => array
(
array
(
'type' => 'regex',
'pattern' => '%(]*>[^<]*)%i',
'explanation' => 'HTML-links are disallowed to combat spam',
),
),
),
int $maxlength
Maximum length of the string encapsulated by this type.
0 means no limit.
This is checked during validation.
string $output_mode
Sets output formatting.
mixed $purify
Run HTML contents through the HTML Purifier library to ensure safe XHTML compatibility.
If left undefined global config according to output_mode is used.
mixed $purify_config
Configuration values for HTML Purifier
mixed $purify_markdown_on_output
Whether Markdown fields should be purified when converted to HTML for output to remove disallowed tags
If left undefined global config is used.
mixed $specialchars_charset
Define the charset to use when htmlspecialchars() is called
mixed $specialchars_quotes
Define the quotes behavior when htmlspecialchars() is called
string $value
The current string encapsulated by this type.