Allow text fields to use the multiline text area widget on content entry forms.
Nothing about a regular, "short" text field with a limit of 255 or 500 or even 2,000 characters logically requires that it be entered in an input field of only one line.
Drupal by default will only give you a widget allowing text entry to be done on one line though. This module removes that restriction. With this module enabled, you can use the textarea widget on a regular text field.
Why?
Any time you want to keep a low, hard limit on the size of what is saved but want to give the person entering content more than a single line with which to do it (or to easily switch from single line to multiline entry, without a migration). Examples:
If you're letting people enter a list free-form rather than using a multivalue textfield, you are unlikely to need the long text size.
Or if you are creating a special teaser field, that too is best entered in a textarea widget but does not need to be saved as long text.
Twitter is a 140 280 character limit (and Mastodon 500), but people use line breaks there to great effect.
You can have ordinary text fields (which map to varchar and similar) with a couple thousand characters perfectly safely even with multibyte Unicode characters; just be sure if you are using this that you very intentionally have a limit because otherwise you should use "Text (long)" for your field.
Doing without this module
If you don't want to rely on this module, you can stick this code in your own custom module or profile, changing 'example' to your module's name:
function example_field_widget_info_alter(&$info) {
$info['text_textarea']['field_types'][] = 'text';
$info['string_textarea']['field_types'][] = 'string'
}
(The first line is for Text (formatted) fields provided by the Drupal core Text module; the latter is for Text (plain) fields provided by Drupal core.)
Project information
- Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Content Editing Experience, Site Structure, Developer Tools
- 1,317 sites report using this module
- Created by mlncn on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Drupal 10 compatibility and better in-module documentation.
Development version: 8.x-1.x-dev updated 13 Nov 2023 at 15:58 UTC
Ported for Drupal 7