Feature #42176

Base Distribution - Work Package #45013: Flexible plugin integration (TODO: Reviews)

Improve resolving of view

Added by Bastian Waidelich about 9 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
Target version:
-
Start date:
2012-10-19
Due date:
% Done:

100%

Estimated time:
120.00 h
PHP Version:
Has patch:
No
Complexity:
medium

Description

Currently the resolution of a view class and the respective (fluid) template happens really early in the MVC dispatching and is not extensible from the "outside".
The actual view & template shold only be resolved while rendering the action, so one can intervene in the action.
Besides view options (e.g. template/layout/widget root paths, view class name, ...) should be overridable via YAML.

Following steps are required:

  • View::canRender() should not be called in ActionController::resolveView() (also remove it from API!)
  • remove “NotFoundView”, instead the View should throw an exception while rendering (see #40888)
  • documentation! (also include a section on how to use the template of a different action)

Views.yaml ( can be easily added through: https://review.typo3.org/#/c/11982/ ):


# Change the template root path for all packages!
-
  options:
    templateRootPaths: ['resource://My.App/Private/Templates']

# Add layout lookup path for all actions of the "Foo" controller in "Some.Package" 
-
  requestFilter: 'isPackage("Some.Package") && isController("Foo")'
  options:
    layoutRootPaths: ['resource://Other.Package/Private/Layouts', 'resource://Some.Package/Private/Layouts']

# Use a custom view for all actions of "Some.Package" if the requested format is "json" 
-
  requestFilter: 'isPackage("Some.Package") && isFormat("json")'
  viewObjectName: 'Other\Package\View\CustomView'

Note: The previous configuration format we envisioned was something like:

My:
  Package:
    viewClassName: TemplateView / TypoScriptView
    options:
      templateRootPath: resources://Other.Package/...
      layoutRootPath: ...
    controllers:
      'List':
        options:
           # ...
       widget:
         'TYPO3\TypoScript\ViewHelpers\Widget\Paginate':
           templateRootPath: ...

        actions:
          'some':
            #...


Files

Views.schema.yaml (1.83 KB) Views.schema.yaml YAML schema for the mentioned configuration format Bastian Waidelich, 2013-01-16 12:21

Related issues

Related to TYPO3.Fluid - Feature #33487: Configure from what package to use Templates/Partial/LayoutsClosedBastian Waidelich2012-01-27

Actions
Related to TYPO3.Fluid - Feature #39870: Allow configuration of template path fallbacksResolvedBastian Waidelich2012-08-16

Actions
Related to TYPO3.Flow - Feature #40857: When template is automatically retrieved but not found, a hint about the tried location should be presentResolvedAdrian Föder2012-09-12

Actions
Related to TYPO3.Flow - Bug #40888: Add ViewNotFoundExceptionResolvedBastian Waidelich2012-09-13

Actions
Related to TYPO3.Flow - Task #43930: Remove canRender() completely?!Needs FeedbackSebastian Kurfuerst2012-12-12

Actions

Also available in: Atom PDF