Story #73183
closedRemoval of frontend simulation in all ViewHelpers
0%
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.
Updated by Gerrit Code Review over 8 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48580
Updated by Gerrit Code Review over 8 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48580
Updated by Gerrit Code Review over 8 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48580
Updated by Gerrit Code Review about 8 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48580
Updated by Gerrit Code Review over 7 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48580
Updated by Benni Mack almost 5 years ago
- Status changed from Under Review to Closed
Hey claus,
I'll close this issue for now. See the discussion on Gerrit. Currently working on further extracting logic from cObj so e.g. parseFunc will work, but that's a separate issue then.