Bug #104221
closedMissing hook in RteHtmlParser for a complete replacement of elements
100%
Description
It is very unfortunate that the only available hook to achieve an individual and complete transformation between RTE <> DB has been removed without replacement and with too little foresight.
All extensions that are dependent on such a transformation, such as all extensions that handle icons/images in the RTE, have thus become useless.
I am currently helping myself with an XClass, but this should not be the solution.
I would therefore like to initiate the discussion and ask for a new hook to be added in v13.
Specifically affected extensions are, for example: Related tasks:Updated by Markus Klein 5 months ago
- Related to Task #92992: Deprecate Hook t3lib/class.t3lib_parsehtml_proc.php:transformation in RteHtmlParser added
Updated by Markus Klein 5 months ago
- Related to Task #96257: Remove t3lib/class.t3lib_parsehtml_proc.php:transformation hook added
Updated by Garvin Hicking 5 months ago
- Status changed from New to Needs Feedback
Could you show your XClass implementation to see what it does where? I guess a PSR-14 event proposal can still be made for v13 at this time, but the more precise we could add "foresight" t it, the better.
Would you like to propose an event implementation?
Updated by Stephan Kellermayr 5 months ago
Basically it's quite simple:
It should be possible to influence the transformation on the way from DB to RTE and from RTE to DB, apart from the existing marginal possibilities, so that a complete modification/replacement of elements can be accomplished on PHP level.
For example, I use my extension to replace an entire <span>
tag with something else (img, svg, etc.).
My current implementation, since version 12, looks like this:
https://github.com/quellenform/t3x-iconpack/blob/b146710442aaf307e56eab497d0a04741cf873bd/Classes/Xclass/RteHtmlParser.php#L68
https://github.com/quellenform/t3x-iconpack/blob/b146710442aaf307e56eab497d0a04741cf873bd/Classes/Xclass/RteHtmlParser.php#L91
Basically, I only add two lines, which could actually be described as "post/pre-processing".
A PSR14 event with regard to version 13 is probably the right choice here. However, I wouldn't presume to suggest a viable solution as I don't currently have much insight into v13.
Updated by Garvin Hicking 5 months ago
- Status changed from Needs Feedback to Accepted
- Assignee set to Garvin Hicking
I see, and do see worth in it.
I'll prepare a patch for this and would love your feedback then, and if we can get common approval for it.
Will take me a couple of days to get to this, though. I'll also need to ensure no other implementations exist to modify the input/output.
Updated by Gerrit Code Review 5 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Stephan Kellermayr 5 months ago
I can't really judge the impact on other situations, but I have just successfully tested this for my particular use case and XCLASS is no longer necessary. Thank you!
Updated by Gerrit Code Review 5 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Gerrit Code Review 5 months ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85079
Updated by Garvin Hicking 5 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6ccf5a0e38ae4ce90e4b6e4cc5f76acbbca19567.