textarea() form()
A multi-line text field; the value is escaped, a rich editor can replace it.
form()->textarea($name, $desc = '', $extra = [], $replace = [])Options
| Option | Meaning |
|---|---|
rows, cols | Size. |
no_escape | Print the value as it is (trusted HTML only). |
ckeditor | Make it a CKEditor (legacy; the site must ship CKEditor). |
tinymce | Make it a TinyMCE editor: see tinymce(). |
contenteditable | false drops the attribute. |
(input options) | desc, placeholder, class, sizing, tip, required, disabled, readonly... |
Example
Code
return form(['comment' => "Line one\nLine <two> & {braces}"])
->textarea('comment', ['rows' => 3])
->textarea('notes', 'Internal notes', ['rows' => 2, 'placeholder' => 'Only staff can see this']);Notes
- The text is escaped (
<,&and template braces), so stored HTML shows as text.
Bootstrap 3 and 5
sizing applies under Bootstrap 5 always, under Bootstrap 3 only with CONF_SIZING_ON_SELECTS_ALL_FW.
See also: form/tinymce, html/textarea