I need to make a change to the CSS of the RTE, and actually the whole site. This change should only happen if chosen in the backends constant editor. (I want to allow chinese and the such in special cases)
My question is whether the RTE is initialized before it can read the correct font/css in accordance of the constant?
This answer is relevant for TYPO3 7.6 and v8 branches. I'm not sure what the situation will be on TYPO3 v9.
The Rich Text Editor (RTE) component is a FormEngine component and FormEngine components work by two patterns:
This means that the RTE is not initialised until quite late (after all structures are created, but before they are rendered - since I am assuming that by "initialised" you mean on the PHP side rather than in the client browser) and you do have the option to read constants and manipulate those structures before they get rendered. And the initialisation you override can indeed depend on TS constants.
A bit more background info that will be required for your task:
TYPO3\CMS\Rtehtmlarea\Form\Element\RichTextElement
- https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php).Hopefully this information is enough to guide you to the perfect solution of adding CSS overrides for any FormEngine component and only trigger it exactly when that type of component gets used.