Smart Trim module - past, present, and future

Published July 18, 2023

Smart Trim module logoThe Drupal Smart Trim module is used by more than 65,000 sites, including over ⅔ on modern Drupal (8+) sites. It has proven to be a valuable tool to improve Drupal's core functionality to trim long text fields in an intelligent manner.

Late in 2022, we released a major update (2.0.0) to the module. Among other improvements, we delivered Drupal 10 compatibility and much improved automated tests. Since then, a 2.1.0 release (completed during the DrupalCon Pittsburgh community contribution day) has brought even more automated tests and functionality.

During DrupalCon Pittsburgh, Mark Casias (markie) and I discussed the future of the Smart Trim module and agreed on a few conceptual ideas that will guide our decisions about the module for the foreseeable future. We decided to share these ideas as a mission statement for the module:

Smart Trim is designed to be a focused, lightweight improvement over Drupal core's current formatter trimming capabilities. The maintainers' focus is stability and ease-of-use. Customizations to the module are encouraged with template overrides and Smart Trim hook implementations.

In short, we don't necessarily want to add more dials and levers to Smart Trim formatter's configuration; rather we are going to focus on stability and ease-of-use while at the same time ensuring that those who want to do more with Smart Trim have the necessary tools at their disposal.

To this end, one of the most significant additions to the 2.1.0 version of the module is that of a smart-trim.html.twig template file. This will allow Drupal developers to have complete control over the output of the module; reducing the need for Smart Trim formatter configuration options. In fact, the current version of the module includes a deprecated configuration setting in the UI that we plan on removing in a future release (other configuration settings that we consider edge cases will also be deprecated in the future.) 

Form element showing deprecation message.

Other improvements to the module over the past few months include:

Another decision that Mark and I made regarding the future of the module is that all commits must have test coverage. This makes a huge difference in the stability and quality of releases.

Most significantly, it cannot be overstated how much community effort, with time contributed by more than a few individuals, has resulted in the progress over the past few months. Among them, I'd like to mention Julian Pustkuchen (Anybody) and James Shields (lostcarpark) for the ongoing efforts. James is a recent graduate of DrupalEasy's Professional Module Development course and has been putting his new skills to use in this and other community projects.

The future of the Smart Trim module is bright. Changes implemented since the 2.1.0 release include:

Our current focus in the short term is on fixing bugs and continued improvements of our automated tests. We are excited about the direction the module is going and look forward to our next release.

Add new comment

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!