Edit on GitHub
Jump to docs navigation

Field Types / Text field

Simple text-input, for single-line fields.

Basic Configuration:

        name:
            type: text

Example usage in templates:

{{ record.name }}

Options:

The field has a few options to change the appearance and functionality of the field.

  • class Can be set to either of the:
    • narrow to make the field less wide
    • large to make both the field and the font larger
  • allow_twig can be set to true or false to control if twig may be used in the field
  • pattern Use this to validate the field against a certain pattern. More about patterns
  • placeholder Placeholder text inside the input control.

Input Sanitisation

All content in this field type will be sanitised before it gets inserted into the database. This means that only 'whitelisted' HTML like <b> and <img src="…"> is kept, while things like <embed> and <script> are scrubbed from the field before being stored. As a site-implementor you can control the whitelisted tags and attributes using the following section in config.yaml:

htmlcleaner:
    allowed_tags: [ div, span, p, br, hr, s, u, strong, em, i, b, li, ul, ol, …, … ]
    allowed_attributes: [ id, class, style, name, value, href, src, alt, title, …, … ]

To disable sanitisation for this field, you can add sanitise: false to the field config, like so:

        title:
            type: text
            sanitise: false

"Hiding" a field

The class:-option can be used to create "hidden" fields. Sometimes you might want to not show a field, but still want to display some information to the editor. For example to give them more detailed instructions on how to use the current ContentType. You can do this:

        helpful_tip:
            type: text
            class: d-none
            label: 'A Helpful tip'
            postfix: |
                Duo Reges: constructio interrete. Eiuro, inquit adridens, hac
                quidem de re; Paulum, cum regem Persem captum adduceret, eodem
                flumine invectio? Videsne quam sit magna dissensio?
            group: Instructions

And the result will be:

Screenshot of a helpful tip



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.