Published on

MaxLength 2.1.2 - A More Reliable and Easier Way to Set Character Limits on Your Drupal Website

In This Article

We released a new version of MaxLength just in time for me to present about it in my session, Designing User-Friendly Drupal Modules at Design4Drupal. 

MaxLength 2.1.2 is a modest improvement with three bug fixes and one new feature.  Seventeen Drupalistas helped on this release. A big thanks to each of you!

A More Accurate Character Count

The most exciting bug fix is that new lines and spaces are no longer miscounted. This was a long standing issue, first reported back in 2017 and the only major bug in the module. 

New lines were being counted as three characters and spaces we counted as two. 

A big thanks to:

Display “Hard Limit” Instead of “Force Truncate” on Form Summary

A small, but annoying bug was both reported and fixed by Paul Leclerc (paul_leclerc). After configuring a hard limit on a field, the form display summary used the old verbiage, “Force truncate” but now it displays hard limit. So satisfying. 

 

Image
Manage form display showing the correct text, "hard limit."

 

Some Code Clean Up

Binoli Lalani ran PHP Codesniffer on MaxLength and found a few issues, which she fixed. This was her first contribution to MaxLength. Thanks Binoli!

Improved Support for Link Fields

Previously MaxLength’s support link fields was limited specifically to the Drupal Core link field and the LinkIt field widgets. Michael Vanetta (recrit) rewrote the code so that any kind of link field widget is now compatible with MaxLength. Michael has contributed quite a few times to the project, so his continued support of the project is much appreciated. 

Looking Ahead for MaxLength

Us maintainers are due for another meeting to set priorities. Some bugs have recently been reported that are worthy of our attention. We would also like to clean up the JavaScript code further to follow best practices. Who knows, we might even get ambitious and rewrite it in vanilla JavaScript so that we no longer require jQuery. If anyone out there has the time and skills to work on any open issues, we always welcome the help. You can reach out in the issue queue or messaging me, cedewey, on drupal.org

Leave a comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA