Long Text
The “Long text” attribute is intended for longer text input. It is displayed as a textarea widget in the backend and can optionally be equipped with a rich text editor (RTE such as TinyMCE). Typical use cases:
Description texts, product descriptions, article texts
Free text fields for multi-line input
HTML content (when RTE is enabled)
The maximum length is 65,535 characters (MySQL type TEXT).
See also
For multilingual MetaModels, the attribute Translated Long Text is available.
See also
This attribute is supported by the File-Usage integration. This allows the Contao file manager to display whether and where a file is embedded.
Installation
The attribute is installed via the Contao Manager or Composer:
composer require metamodels/attribute_longtext
Settings when Creating the Attribute
The long text attribute has no specific settings when creating. Only the general attribute settings are used:
Name, column name, description
Override variants
Settings in Render Settings
The long text attribute has no specific render settings. In the attribute list of a render setting, the usual options are available:
Option |
Description |
|---|---|
Template |
Selection of a custom template for the output of the long text. If no template is specified, the output is as plain text or HTML. |
CSS class |
Optional CSS class added to the output element. |
Settings in the Input Form
When the long text attribute is added to an input form, the following options are available:
Display
Option |
Description |
|---|---|
Backend class |
CSS classes for the display of the field in the backend form (e.g.
|
Template for backend |
Selection of a custom widget template for the backend form. |
Template for frontend |
Selection of a custom widget template for frontend editing (only available if the “Frontend Editing” extension is installed). |
Rich text editor (RTE) |
Activation and selection of a rich text editor (e.g. |
Syntax highlighting mode |
Selection of the syntax highlighting for the source code editor |
Rows |
Number of visible rows of the textarea field (height) — typically overridden by
Contao CSS. When the template |
Columns |
Number of visible characters per row of the textarea field (width) — typically overridden by Contao CSS. |
Functions
Option |
Description |
|---|---|
Required field |
Makes the field a required field. |
Allow HTML input |
Allows the input of HTML tags in the text field (without RTE). |
Keep tags |
HTML tags are not filtered or encoded when saving. |
Decode entities |
HTML entities are decoded when saving. |
Overview (backend filter and search)
Option |
Description |
|---|---|
Filterable |
The attribute is available in the backend as a filter criterion. |
Searchable |
The attribute is available in the backend as a search field. |
Filter Rules
The long text attribute can be used with the following filter rules:
Filter rule |
Note |
|---|---|
Text search |
Free text input for full-text search in the long text field. |
Levenshtein-based search |
Similarity search with typo tolerance; requires the package |
Loupe |
Full-text index search; requires the package |
Special Functions
Rich text editor (RTE)
A RTE such as TinyMCE can be enabled via the input form. Note that the RTE formats the entered HTML content and encodes entities when saving. The “Allow HTML input” option should also be enabled in the functions in that case.
The input widget as TinyMCE can be equipped with a custom jumpTo picker for the detail page.
Database storage
The text is stored as text NULL (up to 65,535 characters). An empty value is stored as
NULL (compatible with MySQL Strict Mode). For longer content, a migration to
mediumtext or longtext directly at the database level may be necessary — this is
described in the cookbook under Input Mask: Adding More Values to Single Select.