Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[String] Allow to keep the last word when truncating a text #35649

merged 1 commit into from Feb 21, 2020


Copy link

franmomu commented Feb 8, 2020

Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #35567
License MIT
Doc PR -

The truncate filter from twig/extensions has a preserve parameter to preserve whole words.

Since twig/extensions is deprecated and its alternative for truncate filter is the use of u filter, this PR adds preverse word functionality.

@franmomu franmomu force-pushed the franmomu:add_preserve_last_word branch from ecff134 to ba6293b Feb 9, 2020
@nicolas-grekas nicolas-grekas force-pushed the franmomu:add_preserve_last_word branch 2 times, most recently from 37879e7 to b28c0f6 Feb 18, 2020
Copy link

nicolas-grekas left a comment

Good to go on my side thanks.
I updated the implementation a bit and renamed the argument to $cut instead, as that looked consistent with wordwrap() to me.

@nicolas-grekas nicolas-grekas force-pushed the franmomu:add_preserve_last_word branch from b28c0f6 to 1cfaeec Feb 18, 2020
fabpot approved these changes Feb 21, 2020

This comment has been minimized.

Copy link

fabpot commented Feb 21, 2020

Thank you @franmomu.

@fabpot fabpot merged commit d33a483 into symfony:master Feb 21, 2020
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Details Your code looks good.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.