User tests: Successful: Unsuccessful:
In articles module, if introtext limit is set to a non zero value, all html tags (ul, li, hx,...) are removed.
In mod_articles/src/Helper/ArticlesHelper.php, line 371, replacing truncate by truncateComplex preserves as much HTML code as possible.
Note : in current version, line 371 contains a bug, it performs a truncate with introtext when it should be displayIntrotext
Create one article with some html like text formatting, ul, li, .... in its first 100 characters.
Create an Articles module so that it will display your article and set introtext limit to 100.
In articles modules, articles are displayed as plain text.
In articles modules, articles are displayed with as much HTML as possible.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Modules Front End |
Title |
|
It works, I can send a successful test. But I agree with the previous comment, the ellipsis on the new line looks not very appropriate.
I think it was overlooked in original PR, but the code should use HTMLHelper::_();
HTMLHelper::_('string.truncate', $text, $length, $noSplit, $allowHtml);
instead of direct call of the helper.
The "..." on a new line are annoying
When we trunscate the text we should show that it is "incomplete".
Usual thing for such cases is to add '...'.
Ah, sorry, you mean "on new line". This probably due to space that may happen.
'string.truncate'
with $allowHtml = true
should fix the issue.
with $allowHtml = true should fix the issue
$item->displayIntrotext = HTMLHelper::_('string.truncate', $item->displayIntrotext, $introtext_limit, true, true);
Nope
Joomla has several truncate functions, I thought the one in Joomla\CMS\HTML\Helpers\StringHelper was working better than the other ones I found ...
I see. Well, that is tricky :)
I see. Well, that is tricky :)
you say it ;-)
Okay, I think what would be better, is to move the trunscating to the layout (out from the helper), then people can overide it. Who want HTML, or plain text.
Okay, I think what would be better, is to move the trunscating to the layout (out from the helper), then people can overide it. Who want HTML, or plain text.
I guess that the best way to go. An other wat is to make an extra option in the module settings. Plain/HTML intro text and keep it in the helper.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-10-04 12:40:40 |
Closed_By | ⇒ | conseilgouz | |
Labels |
Added:
bug
PR-5.2-dev
|
The "..." on a new line are annoying