Feature #39870

Allow configuration of template path fallbacks

Added by Tymoteusz Motylewski about 7 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Could have
Category:
View
Target version:
-
Start date:
2012-08-16
Due date:
% Done:

100%

Has patch:
No

Description

It would be great if you can configure alternative paths for templates. It would be quite handy when you have to extend existing package templates.

Right now it is only possible to set one templateRootPath for package. So even if you want to change only one template file, you have to copy all templates to new location.

This is a placeholder ticket reflecting ticked placed in Extbase.


Related issues

Related to TYPO3.Flow - Feature #42176: Improve resolving of view Resolved 2012-10-19
Related to TYPO3.Fluid - Feature #33487: Configure from what package to use Templates/Partial/Layouts Closed 2012-01-27

Associated revisions

Revision a1173897 (diff)
Added by Bastian Waidelich about 6 years ago

[FEATURE] Fallback paths

With this change it will be possible to define multiple values
for the ``template``, ``partial`` and ``layout`` root path configuration.

Each of the respective options will now have a corresponding setter
that enables configuration of multiple paths to look up when loading a
Fluid template file::

$view->setTemplateRootPaths(array('first/path', 'second/path', …));

The old setters will be kept and they overrule the fallback paths. So::

$view->setTemplateRootPath('some/path');

would disable the fallback paths of the previous example. The same is true
for ``setPartialRootPath()`` and ``setLayoutRootPath()``.

The rootPath-getters have been deprecated in favor of
``getTemplateRootPaths()``, ``getPartialRootPaths()`` and
``getLayoutRootPaths()``.

Change-Id: I530e9a1fadbbd210c980c62cf2022c38fa81bb56
Resolves: #39870
Releases: master

History

#1 Updated by Sebastian Kurfuerst about 7 years ago

  • Priority changed from Should have to Could have

We've internally discussed this topic already quite often, and came to the conclusion that template path inheritance would make the whole system a lot more complex; and especially it is a form of unplanned extension that is very "ad-hoc" -- f.e. by overriding just a single partial it gets very difficult to be able to update the original package when new variables etc are introduced.

While I understand that it might serve a use-case for Extbase, I wouldn't like to add it into FLOW3. There, we have TypoScript as extensibility mechanism which also allows configuring template paths etc.

#2 Updated by Tymoteusz Motylewski about 7 years ago

Sebastian, thank you for your comment! Please see Extbase ticket for general response. I have some questions about FLOW3 side of this change.

Just to clarify - I would like to have the same logic for templates, partials and layouts. I started with templates, but when we agree on how should it be done, then I will implement it for partials and layouts too.

f.e. by overriding just a single partial it gets very difficult
to be able to update the original package when new variables etc are introduced.

Sorry, but I'm not getting the issue here. If new variable was introduced in original package then it makes update your templates much easier, as you only have to change one partial - the one you're overriding.

There, we have TypoScript as extensibility mechanism which also allows configuring template paths etc.

Please elaborate on this a little bit, it seems very interesting. Do you already have a possibility to configure skins/fallback paths for templates in FLOW3 Typoscript? How does it work?

I would like to keep both Fluids in synch, so your input is very important for me :)

#3 Updated by Tymoteusz Motylewski about 7 years ago

I was also thinking about other implementation approach which will not require any change in fluid (only in extbase).
I mean, to set templateRootPath to view in ActionController, then call $view->canRender() (which will check if template exist) if it returns false, than try with fallback path.

This would be quite nice solution for templates, but unfortunatelly we can not use it for partials and layouts - as we can not determine what layouts and partials will be used during rendering, so the view has to know fallback paths himself.

#4 Updated by Christian Kuhn over 6 years ago

It seems, TYPO3 CMS will go ahead here and implements an 'overlay' system with #39868.

This issue is a general demand in extbase/fluid. Simple example is ext:powermail that comes with tons of templates. Mostly, an integrator only wants to adapt just one or a little number of them. To do that, currently all templates have to be copied around and need to be compared if the extension is updated. This is pretty uncool.

I do understand that this feature adds complexity to the system, but it is really useful if used with care.

#5 Updated by Bastian Waidelich over 6 years ago

Christian Kuhn wrote:

I do understand that this feature adds complexity to the system, but it is really useful if used with care.

Christian you're right and we have been convinced in the meantime ;)
We're about to discuss the next steps here, because for Flow we'll soon have a way to solve the issue – but slightly differently (see https://review.typo3.org/#/c/16392/). I'll add you to the doodle for a discussion

#6 Updated by Bastian Waidelich about 6 years ago

  • Category set to View
  • Status changed from New to Accepted
  • Assignee set to Bastian Waidelich

#7 Updated by Gerrit Code Review about 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#8 Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#9 Updated by Gerrit Code Review about 6 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#10 Updated by Gerrit Code Review about 6 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#11 Updated by Gerrit Code Review about 6 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#12 Updated by Gerrit Code Review about 6 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22658

#13 Updated by Bastian Waidelich about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF