Installing and Configuring Maxlength
Installation
Install the Maxlength module using the standard installation method for contributed modules.
It is recommended that you use composer to install the module.
composer require drupal/maxlength
Once installed, be sure to enable the module.
Configuration
Once Maxlength is installed and enabled, configure a Maxlength for the fields of your choosing. You can apply a maximum length to the following field types:
- Link
- Text (formatted)
- Text (formatted, long)
- Text (formatted, long, with summary)
- Text (plain)
- Text (plain, long)
- Title
Navigate to the Manage form display page of the intended entity.
For example, Structure > Content Types > Article > Manage form display (/admin/structure/types/manage/article/form-display)
Click the gear icon next to the field you want to set a maximum length to.
Maxlength provides the following configuration options:
- The maximum number of characters allowed
- The countdown message, including tokens for character limit, characters remaining, and characters used.
- Force truncation
- Force truncation, but ignore html tags in character count
WYSIWYG Compatibility
Maxlength is compatible with tinyMCE and CKEditor.
Enabling MaxLength on All The Fields
Want MaxLength on all fields that have a #maxlength
key? Install and enable the MaxLength Auto module.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion