Story #73183

Removal of frontend simulation in all ViewHelpers

Added by Claus Due about 3 years ago. Updated almost 2 years ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2016-02-08
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Sprint Focus:

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:

  1. There is no utility currently which allows perfectly simulating the frontend
  2. The only way to simulate the frontend from a ViewHelper is to set up and construct the fake on every execution
  3. Simulation can be very expensive and is only necessary in some use cases
  4. 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.


Related issues

Related to TYPO3 Core - Bug #71361: fluid link.typolink crashes in Backend with page links Under Review 2015-11-06
Related to TYPO3 Core - Bug #66855: Format/HtmlViewHelper don't render Links in TYPO3_MODE = BE Under Review 2015-05-08
Related to TYPO3 Core - Bug #75314: HtmlViewHelper ignores stdwrap hooks Closed 2016-03-30
Related to TYPO3 Core - Bug #73163: RTE in FE does not show available blockstyles at first try New 2016-02-06
Related to TYPO3 Core - Bug #71771: RTE.default.contentCSS is broken in Frontend Closed 2015-11-22
Related to TYPO3 Core - Bug #67556: System news cannot render RTE content Under Review 2015-06-17
Precedes TYPO3 Core - Bug #76489: f:cObject resets other global parameters in fluid_styled_content Needs Feedback 2016-06-07

History

#1 Updated by Gerrit Code Review almost 3 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

#2 Updated by Gerrit Code Review almost 3 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

#3 Updated by Gerrit Code Review almost 3 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

#4 Updated by Gerrit Code Review over 2 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

#5 Updated by Gerrit Code Review almost 2 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

Also available in: Atom PDF