Project

General

Profile

Actions

Bug #104221

closed

Missing hook in RteHtmlParser for a complete replacement of elements

Added by Stephan Kellermayr 5 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2024-06-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
Tags:
rte,transformation,rtehtmlparser,icons
Complexity:
easy
Is Regression:
Sprint Focus:

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:

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #92992: Deprecate Hook t3lib/class.t3lib_parsehtml_proc.php:transformation in RteHtmlParserClosed2020-12-04

Actions
Related to TYPO3 Core - Task #96257: Remove t3lib/class.t3lib_parsehtml_proc.php:transformation hookClosedOliver Bartsch2021-12-06

Actions
Actions #1

Updated by Stephan Kellermayr 5 months ago

  • Target version set to 13.2
Actions #2

Updated by Markus Klein 5 months ago

  • Related to Task #92992: Deprecate Hook t3lib/class.t3lib_parsehtml_proc.php:transformation in RteHtmlParser added
Actions #3

Updated by Markus Klein 5 months ago

  • Related to Task #96257: Remove t3lib/class.t3lib_parsehtml_proc.php:transformation hook added
Actions #4

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?

Actions #5

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.

Actions #6

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.

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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!

Actions #12

Updated by Benni Mack 5 months ago

  • Target version changed from 13.2 to 13.3
Actions #13

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

Actions #14

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

Actions #15

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

Actions #16

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

Actions #17

Updated by Garvin Hicking 5 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #18

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF