Would like to see an option to preserve certain HTML tags when "strip HTML tags" is enabled. Patch attached that adds this functionality in.

When seeing field formatter options a new field is added for "Tags to preserve". This then uses the extra preserve_tags parameter of PHP's strip_tags function.

Issue fork smart_trim-1806498

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lazysoundsystem’s picture

Status: Active » Reviewed & tested by the community

I agree, this option is smart and useful and the patch works well.

shadcn’s picture

+1 from me. Works well.

drywall’s picture

Thanks for this patch! I didn't incorporate it into 1.4 since I wanted that to be more of a bugfix release. I may roll this and whatever solution someone winds up coming up with for #1812882: Trim on sentence boundary or word boundary for both character and word trim options into a 7.x-2.0 release since there would be both meaningful new features and behavior changes.

lazysoundsystem’s picture

StatusFileSize
new1.74 KB

Re-rolling the patch against current version (1.4).

drywall’s picture

Awesome, thanks for making my life easier. :)

lolandese’s picture

Is there a commit planned?

judapriest’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

Both patch #1 and #4 need re-roll on their version.

And adding States Api could be quite nice too.

  • 2c42de4 committed on 7.x-1.x
    Issue #1806498 by lazysoundsystem, kbasarab: Added preserve tags option...
markie’s picture

Status: Needs work » Fixed

#4 has been pushed to dev branch for your testing pleasure. Please let me know if you find any issues.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sleopold made their first commit to this issue’s fork.