#73183Removal of frontend simulation in all ViewHelpers
Description
This issue is to remind of and discuss the following opinionated argument:
“No ViewHelpers should themselves simulate any part of the frontend. Instead, they should throw exceptions if detecting an incomplete frontend context (TSFE, etc.)”
The argument goes as follows:
- There is no utility currently which allows perfectly simulating the frontend
- The only way to simulate the frontend from a ViewHelper is to set up and construct the fake on every execution
- Simulation can be very expensive and is only necessary in some use cases
- Frontend simulation should be opt-in and a conscious decision from the developer (dev should be in control of it)
Rather than perform obscured frontend simulations each ViewHelper can instead simply verify the environment it needs and throw a special exception if one isn’t found, informing the developer to simulate the frontend before he renders his View and tear it down once he is done rendering.
In terms of performance another solution exists. It would be even simpler to assume that a proper frontend is simulated and throw whichever error happens to occur, e.g. “undefined variable”, “call to undefined method” etc. and clearly document in each ViewHelper’s documentation block (not in code) what it requires of the frontend context. The argument being that we don’t necessarily have to carefully handle every conceivable context problem as long as we inform that “this ViewHelper requires a frontend context minimally consisting of a TSFE with a page repository” and expect the developer to know what that implies if he wants to use that ViewHelper in the backend.
Reviews 1
Related issues 7
- Bug #66855Format/HtmlViewHelper don't render Links in TYPO3_MODE = BE
- Bug #67556System news cannot render RTE content
- Bug #71361fluid link.typolink crashes in Backend with page links
- Bug #71771RTE.default.contentCSS is broken in Frontend
- Bug #73163RTE in FE does not show available blockstyles at first try
- Bug #75314HtmlViewHelper ignores stdwrap hooks
- Bug #76489f:cObject resets other global parameters in fluid_styled_content