Hello,
I'd like to add a functionnality for the TextTrimmedFormatter to be able to add an ellipsis and / or word boundaries trim options.
Patch attached.
| Comment | File | Size | Author |
|---|
Issue fork drupal-2959924
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
Comment #2
b2f commentedComment #3
b2f commentedPatch update
Comment #4
b2f commentedComment #5
b2f commentedComment #6
b2f commentedPatch updated with schema data.
Comment #7
b2f commentedComment #8
b2f commentedComment #9
b2f commentedComment #10
b2f commentedComment #12
anfor commentedI rerolled the patch on 8.7.x branch and made some changes.
I put back the issue to "Needs work", since tests coverage isn't done.
And more importantly, I think it might be best to create a custom Formatter.
Comment #17
aporieSubscribed.
Don't think it's best to create a new custom formatter. This option could ship with the default core TextTrimmedFormatter as I don't see any cases where you want to trim your content without having the possibility to add ellipsis. (You see what I m...).
Just tested #12 on 8.9.8, works well.
Comment #19
alexandre.todorov commentedHi,
Here is a rerolled patch for branch 9.1.x with the following improvements :
text_summary()function uses "breakpoints" trim which will remove the ellipsis. So append the ellipsis after the "breakpoints" trim.Comment #20
alexandre.todorov commentedAdd the ellipsis (if needed) when using the delimiter
Comment #21
alexandre.todorov commentedFYI the same patch as #20, but without indentation for simpler reading
Comment #24
karltud123 commented+1
Comment #26
chikeHow different is this from what Smart Trim offers?
Comment #27
fskreuz commentedRe-roll against 9.5.x
Comment #28
_utsavsharma commentedTried to fix CCF for #27.
Please review.
Comment #29
_utsavsharma commentedComment #32
fskreuz commentedReroll of #21 for 10.2.x.
Added both indent and no-indent versions, since the files involved are frequently modified by updates. The indented version is the one meant to be merged, while the no-indent version is for easy composer patching.
Comment #33
nod_Can we have an MR for this?
Comment #36
nod_thx
Comment #37
nod_Comment #39
fskreuz commentedRebased to latest main branch. Hiding the older patches. Probably needs tests, leaving as Needs Work.