Bug #73207

Changing the Template of a fluid widget does not work

Added by Stefan Froemken almost 3 years ago. Updated 10 months ago.

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

100%

TYPO3 Version:
8
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Hello,

I want to change the template of a fluid widget with following TypoScript:

module.tx_devlog.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPaths {
  10 = EXT:devlog/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html
}

I have also tried that one:

module.tx_devlog.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:devlog/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html

While processing these values in Fluid, my template will be added AFTER the Fluid one. But in extractPathArrays you resort the values with krsort. Now my template is the first one and will be overwritten by Fluidtemplates again.

With my last idea I overwrite the full template path of Fluid:

module.tx_fluid.view.templateRootPaths {
  10 = EXT:devlog/Resources/Private/Templates/
}

Now my template path will be added BEFORE the Fluid one. In extractPathArray the templates will be resorted again and my template path is the last one. Yeah. That's correct.

Stefan


Related issues

Related to TYPO3 Core - Bug #84575: Fluid autocomplete widget not working anymore New 2018-04-02

Associated revisions

Revision 5b1dff4c (diff)
Added by Helmut Hummel about 1 year ago

[BUGFIX] Fix Fluid template path issues

Resolves: #82344
Resolves: #82181
Resolves: #73207
Related: #82407
Releases: master, 8.7
Change-Id: Icd0a8aa3f1646315c094ad8768e2ff0bb34033d9
Reviewed-on: https://review.typo3.org/53958
Tested-by: TYPO3com <>
Reviewed-by: Claus Due <>
Tested-by: Claus Due <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision 2074d366 (diff)
Added by Helmut Hummel about 1 year ago

[BUGFIX] Fix Fluid template path issues

Resolves: #82344
Resolves: #82181
Resolves: #73207
Related: #82407
Releases: master, 8.7
Change-Id: Icd0a8aa3f1646315c094ad8768e2ff0bb34033d9
Reviewed-on: https://review.typo3.org/54156
Tested-by: TYPO3com <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

History

#1 Updated by Claus Due almost 3 years ago

Could you try "10 = EXT:devlog/Resources/Private/Templates/ViewHelpers/Widget/" instead, please? The values should be root paths (excluding the Widget's controller name) so the "Paginate/Index.html" part should be added when resolving the template. It's basically the same as putting nested view configuration in "widget.$className".

#2 Updated by Wouter Wolters almost 3 years ago

  • Status changed from New to Needs Feedback

#3 Updated by Stefan Froemken almost 3 years ago

Sorry. It doesn't work.

In setViewConfiguration() we have a call to $view->getTemplatePaths()->fillFromConfigurationArray() which sets my configuration. Everything is alright until now.

Just 2 or 3 Rows later canRender() will be called, which executes $this->setControllerContext(). The problem is here: $this->baseRenderingContext->getTemplatePaths()->fillDefaultsByPackageName($request->getControllerExtensionKey()); which overwrites my previously (correct) defined settings with defaults again.

Stefan

#4 Updated by Frank Naegler almost 3 years ago

For news the overwrite looks like this:

plugin.tx_news.view.widget.GeorgRinger\News\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:news/Resources/Private/Templates/

can you try this with adapted paths?

#5 Updated by Stefan Froemken over 2 years ago

I have tried these versions now:

module.tx_devlog.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPaths {
10 = EXT:devlog/Resources/Private/Templates/
}

and

module.tx_devlog.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:devlog/Resources/Private/Templates/

Both does not work.

#6 Updated by Alex Kellner over 2 years ago

Can confirm this. It's not possible to set an own HTML-Template in my backend module for TYPO3 8.0

module.tx_powermail {
    view {
        widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:powermail/Resources/Private/Templates/
        widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPaths {
            10 = EXT:powermail/Resources/Private/Templates/
        }
    }
}

templateRootPath seems to work in 7.6

#7 Updated by Benni Mack over 2 years ago

  • Target version changed from 8.0 to 8.2

#8 Updated by Benni Mack over 2 years ago

  • Target version changed from 8.2 to 8.3

#9 Updated by Benni Mack over 2 years ago

  • Target version changed from 8.3 to 8.4

#10 Updated by Dominik Hahn about 2 years ago

Hey guys,

the same happened to me today, after updating TYPO3 CMS to the latest dev-master.

We have two extensions:
The first one defines the paths to it's templates by using templateRootPaths.1
the second extension extends those paths (and overwrites certain templates) by using templateRoothPaths.10

I was wondering why the templates of the second extension (albeit the higher index) were not showing up in the templates after performing the update.

Debugging the method 'getContextSpecificViewConfiguration()' of the 'TemplatePaths' class with a var_dump() I have learnt that this function seems to be executed twice for every plugin on the page.

On the first call:

/srv/www/public/sites/debugging/vendor/typo3/cms/typo3/sysext/fluid/Classes/View/TemplatePaths.php:116:
array (size=3)
  0 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension/Resources/Private/Templates/' (length=106
  1 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension/Resources/Private/Templates/Plugins/' (length=114)
  10 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension_two/Resources/Private/Templates/Extensions/Demo/Plugins/' (length=146)

On the second call:

/srv/www/public/sites/debugging/vendor/typo3/cms/typo3/sysext/fluid/Classes/View/TemplatePaths.php:116:
array (size=3)
  0 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension_two/Resources/Private/Templates/Extensions/Demo/Plugins/' (length=146)
  1 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension/Resources/Private/Templates/Plugins/' (length=114)
  2 => string '/srv/www/public/sites/debugging/Web/typo3conf/ext/custom_extension/Resources/Private/Templates/' (length=106)

I guess the second call wins, the index of my custom templates is set to "0" and the default templates are loaded.

It all drills down to the setControllerContext method of the AbstractTemplateView as already pointed out in https://forge.typo3.org/issues/73207#note-3

I really hope this helps resolving this annoying problem.
As a temporary fix, I am completely overwriting templateRootPaths.1 in my second extension.

#11 Updated by Benni Mack about 2 years ago

  • Target version changed from 8.4 to 8.5

#12 Updated by Frank Naegler about 2 years ago

  • Status changed from Needs Feedback to Accepted

#13 Updated by Mark Watney almost 2 years ago

I can also can confirm this with TYPO3 CMS 8.5.0.

#14 Updated by Gerrit Code Review almost 2 years ago

  • Status changed from Accepted 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/51057

#15 Updated by Benni Mack almost 2 years ago

  • Target version changed from 8.5 to 8.6

#16 Updated by Benni Mack almost 2 years ago

  • Target version changed from 8.6 to 8 LTS

#17 Updated by Benni Mack over 1 year ago

  • Target version changed from 8 LTS to next-patchlevel

#18 Updated by Denis Mir about 1 year ago

I can confirm this issue on TYPO3 8.7.6. It is still not possible to override the template of the paginate widget. (I have tried out several ways of configuring it) Neither `templateRootPath` nor `templateRootPaths` does work.

#19 Updated by Gerrit Code Review about 1 year 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/54140

#20 Updated by Gerrit Code Review about 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#21 Updated by Gerrit Code Review about 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#22 Updated by Gerrit Code Review about 1 year ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#23 Updated by Gerrit Code Review about 1 year ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#24 Updated by Gerrit Code Review about 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53958

#25 Updated by Gerrit Code Review about 1 year ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#26 Updated by Gerrit Code Review about 1 year ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53958

#27 Updated by Gerrit Code Review about 1 year ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#28 Updated by Gerrit Code Review about 1 year ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53958

#29 Updated by Gerrit Code Review about 1 year ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53958

#30 Updated by Gerrit Code Review about 1 year ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#31 Updated by Gerrit Code Review about 1 year ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#32 Updated by Gerrit Code Review about 1 year ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53958

#33 Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54156

#34 Updated by Helmut Hummel about 1 year ago

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

#35 Updated by Gerrit Code Review about 1 year ago

  • Status changed from Resolved to Under Review

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#36 Updated by Gerrit Code Review about 1 year ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#37 Updated by Gerrit Code Review about 1 year ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#38 Updated by Gerrit Code Review about 1 year ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#39 Updated by Gerrit Code Review about 1 year ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#40 Updated by Gerrit Code Review about 1 year ago

Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#41 Updated by Gerrit Code Review about 1 year ago

Patch set 20 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#42 Updated by Gerrit Code Review about 1 year ago

Patch set 21 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#43 Updated by Gerrit Code Review about 1 year ago

Patch set 22 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#44 Updated by Gerrit Code Review about 1 year ago

Patch set 23 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#45 Updated by Gerrit Code Review about 1 year ago

Patch set 24 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#46 Updated by Gerrit Code Review about 1 year ago

Patch set 25 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#47 Updated by Gerrit Code Review about 1 year ago

Patch set 26 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#48 Updated by Gerrit Code Review 10 months ago

Patch set 27 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#49 Updated by Gerrit Code Review 10 months ago

Patch set 28 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#50 Updated by Gerrit Code Review 10 months ago

Patch set 29 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#51 Updated by Gerrit Code Review 10 months ago

Patch set 30 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#52 Updated by Gerrit Code Review 10 months ago

Patch set 31 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#53 Updated by Gerrit Code Review 10 months ago

Patch set 32 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#54 Updated by Gerrit Code Review 10 months ago

Patch set 33 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#55 Updated by Gerrit Code Review 10 months ago

Patch set 34 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#56 Updated by Gerrit Code Review 10 months ago

Patch set 35 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#57 Updated by Gerrit Code Review 10 months ago

Patch set 36 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#58 Updated by Gerrit Code Review 10 months ago

Patch set 37 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#59 Updated by Gerrit Code Review 10 months ago

Patch set 38 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#60 Updated by Gerrit Code Review 10 months ago

Patch set 39 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#61 Updated by Gerrit Code Review 10 months ago

Patch set 40 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#62 Updated by Gerrit Code Review 10 months ago

Patch set 41 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#63 Updated by Gerrit Code Review 10 months ago

Patch set 42 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#64 Updated by Gerrit Code Review 10 months ago

Patch set 43 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#65 Updated by Gerrit Code Review 10 months ago

Patch set 44 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54140

#66 Updated by Riccardo De Contardi 6 months ago

  • Related to Bug #84575: Fluid autocomplete widget not working anymore added

Also available in: Atom PDF