Issue Bug Closed

#105593Extbase action via userFunc Bootstrap->run: Overrule templateRootPaths seems not to work

Alex Kellner 11/13/24, 16:01 updated 11/14/24, 16:42

Description

I just stumbled over the issue that it seems not possible to add additional templateRootPaths via TypoScript when using TYPO3\CMS\Extbase\Core\Bootstrap->run for an action (in TYPO3 12 and 13).

How to reproduce

Extension A: ext_localconf.php

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
  'Lux',
  'Test',
  [\In2code\Lux\Controller\FrontendController::class => 'test']
);

Extension A: TypoScript setup

test = PAGE
test {
  typeNum = 123456

  10 = USER_INT
  10 {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = Lux
    pluginName = Test
    vendorName = In2code
    controller = Frontend
  }
}

Extension A: Controller

<?php

declare(strict_types=1);
namespace In2code\Lux\Controller;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class FrontendController extends ActionController
{
    public function testAction(): ResponseInterface
    {
        return $this->htmlResponse();
    }
}

The HTML template from Path EXT:lux/Resources/Private/Templates/Frontend/Test.html is used for templateRootPaths.0 (even if it is not explicitly defined in TypoScript) – what’s correct.

But if an additional Extension sets another path with .10, the original path is still used:

plugin.tx_lux_test.view.templateRootPaths.10 = EXT:luxenterprise/Resources/Private/Templates/Frontend

—-

If I doublecheck the paths by simply removing the original template file, the additional file is used correctly. Even the used TypoScript seems to be correct in backend.

A debug of the ActionController seems to be okay for me:

0 => 'EXT:lux/Resources/Private/Templates/' (36 chars)
1 => 'EXT:luxenterprise/Resources/Private/Templates/Frontend' (54 chars)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 4

  1. Garvin Hicking changed category 11/13/24, 17:27

  2. Garvin Hicking commented and changed status New Needs Feedback 11/13/24, 17:38

    Thanks for the report.
    To make debugging easier, are you maybe able to provide a minimal extension showcasing this in a repository or ZIP? And do you know if this ever worked, in v11 for example?

    (I didn’t investigate this properly, but pinged Simon and we’d like to have a look but are a bit short on time. But next week it’s code sprint so something like this could be a good topic)

  3. Alex Kellner commented 11/14/24, 16:40

    Thx for your time. Ticket can be closed (seems that I’m getting too old for TYPO3).
    Overwriting works as expected in TYPO3 11, 12 and 13 here.

    —-

    # Wrong path
    plugin.tx_lux_test.view.templateRootPaths.10 = EXT:luxenterprise/Resources/Private/Templates/Frontend/
    
    # Correct path (without Controller name as folder)
    plugin.tx_lux_test.view.templateRootPaths.10 = EXT:luxenterprise/Resources/Private/Templates/
  4. Garvin Hicking commented and changed status Needs Feedback Closed 11/14/24, 16:42

    Thank you for adding this and solving this. I didn’t spot that, too, in first place if that helps you feeling less old. Then again, I’m old too…. :-P