Skip to main content

Timeline for How to trim body text (field_body)?

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Sep 30, 2017 at 1:22 comment added squall3d @logeshvaran you can pass a parameter to stiptags so it ignores image tags. e.g. {{ your_html|striptags('<img>') }} . You can refer to twig.symfony.com/doc/2.x/filters/striptags.html
Aug 10, 2017 at 7:09 comment added logeshvaran If I use the image in the body field. No 2 , is not working for images. Is there any other code, will print the image as well
Sep 25, 2016 at 13:04 comment added squall3d @zhilevan usually when I want to display truncated text it's for the purpose of a teaser, where I seldom want html. But if you do need to preserve html, you can try this extension: gist.github.com/leon/2857883
Sep 25, 2016 at 12:57 comment added Yuseferi @squall3d what is your solution for slice it without strip htmls?
Sep 25, 2016 at 12:54 comment added squall3d @zhilevan yep, as described in the answer.
Sep 25, 2016 at 12:31 comment added Yuseferi first solution malformed tags and second solution strip all html tags.
May 9, 2016 at 5:56 vote accept marco-s
May 6, 2016 at 16:44 history answered squall3d CC BY-SA 3.0