0

I have nodes with text and images in the body field. I wish to remove the images from the teaser texts, currently created with the "Summary or Trimmed" field display option.

Is there a hook or similar for altering the field before it's output in the teaser? Or would this require writing a custom field formatter?

7

I have had good luck using the Smart Trim module. (This module is now available for Drupal 7 and 8.)

Choose the Smart Trimmed field formatter and check the Strip Out HTML checkbox to remove the image tags (and other formatting that you probably don't want in a teaser text).

It also gives you some other handy formatting options (limit to number of words or characters, add "read more" links, etc) and makes the formatting options available for fields in Views, as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.