Feature #7113

Make view resolution in ActionController independent from Fluid

Added by Christopher Hlubek over 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-04-02
Priority:Should have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:MVC
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 11
PHP Version: Complexity:
Has patch:

Description

Currently the view for any ActionController is tied to Fluid. For every action processed, a Fluid TemplateView will be created. Only if a template cannot be found the format is taken into account for the view object name.

This will work out as long as there is no Fluid template for an action that should be rendered with another view. Considering the case that we need format specific views (JSON, PDF, CSV, ...) for the same action that also renders HTML we need to change the current mechanism.

I would propose a priority based resolver like used for the request handlers. So a view would then be resolved by a view resolver that checks if a view implementation can handle the current request (most commonly by checking the format).


Related issues

related to TYPO3.Neos - Task #7349: Resolve issue #7113: Make view resolution in ActionContro... Resolved

Associated revisions

Revision 4d203b18
Added by Robert Lemke almost 5 years ago

[~TASK] FLOW3 (MVC): Changed the order how views are resolved: If a dedicated view exists for the controller / action pair, it is chosen instead of the Fluid Template View.
[+FEATURE] FLOW3 (MVC): The ActionController now allows for specifying view object names for each format, e.g. a specific view for JSON request, another one for HTML etc. Resolves #7113
[!!!]][API] FLOW3 (MVC): Added a new method to the ViewInterface: canRender() must tell if the view is able to render something meaningful for the given controller context.
[~TASK] Fluid (View): Adjusted the template view to the extended ViewInterface.

Change-Id: I36517e1fbd70d26c049e33ac662a5d8ae686d278

History

#1 Updated by Sebastian Kurfuerst over 5 years ago

I'll be available for such discussions

#2 Updated by Robert Lemke about 5 years ago

  • Assigned To set to Christopher Hlubek
  • Target version set to 1.0 alpha 11

Okay, I think a decision based on the format would be okay. How about defining that directly in the Controller in form of an array?

$formatToViewObjectNameMap = array(
   '*' =>'F3\Fluid\View\TemplateView',
   'json' => '....MyOwnView',
   ..
);

could support regex.

Even if you don't like my suggestion, just start working on it ... you'll know how.

#3 Updated by Robert Lemke almost 5 years ago

  • Status changed from New to Accepted
  • Assigned To changed from Christopher Hlubek to Robert Lemke

#4 Updated by Robert Lemke almost 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r5023.

#5 Updated by Julian Kleinhans almost 5 years ago

I think there is something wrong..
since yesterday, after update the latest trunk i get a 404 with this error message from the action controller. "Sorry, the page you requested was not found. The technical reason is: No template was found. View could not be resolved for action "index".

Is there any change in the conventions ?
I have a StandardController with a indexAction method and i have a template in Resources/Private/Templates/Standard/index.html

any ideas ?

#6 Updated by Franz Kugelmann almost 5 years ago

Hi Julian,

did you try with the Template-name in UpperCase (Index.html)?
At least on non-Windows that makes a big difference :)
If i remember correctly, that was necessary at some point some months ago.

Julian Kleinhans wrote:

I think there is something wrong..
since yesterday, after update the latest trunk i get a 404 with this error message from the action controller. "Sorry, the page you requested was not found. The technical reason is: No template was found. View could not be resolved for action "index".

Is there any change in the conventions ?
I have a StandardController with a indexAction method and i have a template in Resources/Private/Templates/Standard/index.html

any ideas ?

Also available in: Atom PDF