- 🇮🇪Ireland lostcarpark
Just looking back at this issue. If we move to a .twig template, it may be difficult to only apply the template if the field was trimmed. Could we achieve the same thing by adding a class that indicates whether the content was trimmed or not?
- 🇮🇪Ireland lostcarpark
Actually, if we just add a boolean flag to the variables passed into the template file, indicating whether the field was trimmed or not, the theme could use it however it likes. It would then be a simple matter to use an
{% if %}
to apply the wrapper, or modify the output as required. - 🇺🇸United States ultimike Florida, USA
@lostcarpark's idea in comment 9 sounds good to me. Simple, elegant, flexible.
Obviously, we should add the variable name to a comment at the top of the Twig file that ✨ Add config option for more link wrapper Fixed will add 😀
-mike
- Status changed to Postponed
almost 2 years ago 6:16pm 29 May 2023 - 🇮🇪Ireland lostcarpark
Marking postponed pending merge of ✨ Add config option for more link wrapper Fixed .
It should be a fairly simple change, but discussed with @ultimike and agreed that change is already quite complex, so wrapping this change in with it would likely cause confusion. I'm happy to work on it when that change has been merged.
- Assigned to lostcarpark
- Status changed to Needs work
almost 2 years ago 11:20pm 20 June 2023 - Merge request !54Issue #3155207: Only wrap when content is actually trimmed → (Merged) created by lostcarpark
- 🇮🇪Ireland lostcarpark
Opened MR !54, which adds new variable,
is_trimmed
to Twig file.
Added test to verify.
Test adds{% if is_trimmed %}
to test template, and checks for it in test case. - Status changed to Needs review
almost 2 years ago 12:51am 21 June 2023 - 🇮🇪Ireland lostcarpark
Rebased !54 (manual rebase required because two branches had added a function to SmartTrimTemplateTest, which git found difficult to merge automatically).
All tests passing, except known "new static()" issue in phpstan.
I think this change makes sense because it allows the .twig template to decide whether to wrap the output using the
is_trimmed
flag, without adding an additional option to the configuration. - Status changed to Needs work
about 1 year ago 4:15pm 4 February 2024 - 🇺🇸United States ultimike Florida, USA
Forgive me if I'm missing something (it's been awhile since I looked at this issue), but this MR doesn't actually use the new
is_trimmed
twig variable, correct? Shouldn't we be updating line 19 of smart-trim.html.twig file to something like:{% if wrap_output == true and is_trimmed == true %}
It's entirely possible that I'm misreading things - feel free to correct me if I'm wrong.
-mike
- 🇮🇪Ireland lostcarpark
You're correct that it's not currently using
is_trimmed
in the default template. I'm not sure that it needs to be.The aim of the change was to make the
is_trimmed
variable available to the .twig template for those that want to use it.If people feel that there's value in using it in the default template, I'm happy to add it.
- 🇮🇪Ireland lostcarpark
Rebased on the latest 2.1.x.
Next major is currently failing, but I don't think it's caused by anything in this MR.
- Status changed to Needs review
about 1 year ago 10:37pm 4 February 2024 -
ultimike →
committed 50f9ffeb on 2.1.x authored by
lostcarpark →
Issue #3155207 by lostcarpark, markie, rwohleb, cindytwilliams, ultimike...
-
ultimike →
committed 50f9ffeb on 2.1.x authored by
lostcarpark →
- Status changed to Fixed
about 1 year ago 4:11pm 6 February 2024 - 🇺🇸United States ultimike Florida, USA
@markie let me know via Slack DM that he's good with this change as well - merged!
thanks,
-mike Automatically closed - issue fixed for 2 weeks with no activity.