Smart Trim

Module Drupal Illustration Voir sur Drupal.org
Nb téléchargements : 64123

Components

  • Code
  • Documentation
  • Miscellaneous
  • User interface

Documentation

Images


Ecosystem

Licence

https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

permet de couper des champs texte

Release

Status : Published
Projects : Modules
Maintenance status : Actively maintained
Development status : Under active development
Supported Branches : 2.1., 2.2.
shield Stable releases for this project are covered by the security advisory policy.




Description

Smart Trim implements a new field formatter for textfields (text, text_long, and text_with_summary) that improves upon the "Summary or Trimmed" formatter built into Drupal core.

Requirements

Drupal contrib modules

Installation

Install and enable Smart Trim as you would any other contributed module. See
https://www.drupal.org/docs/extending-drupal/installing-modules

Configuration

After installing and enabling Smart Trim, you will see a "Smart trimmed" option in the format dropdown for your text fields. For content types, this is located on the "Manage Display" page. With Smart Trim, you have control over:

  • The trim length
  • Whether the trim length is measured in characters or words
  • Appending an optional suffix at the trim point
  • Configuring (optional) "More" link immediately after the trimmed text
  • Stripping out HTML tags from the field
  • Ability to customize the trimmed content via template override

The "More" link functionality may not make sense in many contexts, and may be redundant in situations where "Read More" is included in set of links included with the node. But it's there if you need it.

As Smart Trim provides a field formatter, use it anywhere field formatters are available, including Layout Builder and Views.

Mission statement

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.

Documentation

Getting started (example)

  1. Navigate to Administration > Extend and enable the module.
  2. Navigate to Administration > Structure > Content types > Article > Manage display, then click to configure the "Teaser" view mode.
    (/admin/structure/types/manage/article/display/teaser)
  3. Select Smart trimmed as the Format for the Body field.
  4. Click the configuration gear for the Body field.
  5. Update Smart Trim formatter configuration as desired. Configuration options include:
    • Trim by number of characters or words.
    • Customize the "More" link.

As Smart Trim provides a field formatter, use it anywhere field formatters are available, including Layout Builder and Views.

Full documentation

https://www.drupal.org/docs/contributed-modules/smart-trim

Maintenance plan

The latest release is compatible with Drupal 9 and 10. Drupal 7 is minimally maintained.



Toutes les informations proviennent du site drupal.org