Project

General

Profile

Actions

Bug #105038

closed

LoginProviderInterface - modifyView searches for Templates in cms-backend

Added by David Hoeckele about 1 month ago. Updated 5 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Authentication
Target version:
-
Start date:
2024-09-19
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hey,
I'm trying to migrate the ->render call to ->modifyView (the way described in the documentation: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Backend/LoginProvider.html#login-provider-interface-migration)

Doing so will always fail, because it's searching for the template in 'cms-backend' and i don't see a way to override this template path.

Thanks in regards,
David


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #104773: Implement and use a core ViewFactoryInterfaceClosed2024-08-29

Actions
Actions #1

Updated by Garvin Hicking about 1 month ago

  • Category set to Authentication
  • Status changed from New to Needs Feedback

In the modifyView method you should have your $view standalone view object. There you should be able to use setTemplatePathAndFilename to adjust the used template files for rendering, have you tried that?

If that doesn't work maybe you can share your code so we can have a closer look.

Actions #2

Updated by David Hoeckele about 1 month ago

the $view of the modifyView method is no longer a StandaloneView , it's an ViewInterface without a setTemplateAndFilename method. The render() method of the ViewInterface says "Optionally receives a template location" - but I think that path is meant inside of the extension and not to override the path here (I tried, it didn't work).

I took a look into the TYPO3\CMS\Backend\Controller\LoginController - the template paths of the modifyView method are hard-coded without an option to override:

$viewFactoryData = new ViewFactoryData(
    templateRootPaths: ['EXT:backend/Resources/Private/Templates'],
    partialRootPaths: ['EXT:backend/Resources/Private/Partials'],
    layoutRootPaths: ['EXT:backend/Resources/Private/Layouts'],
    request: $request,
);

It is possible to set a $templatePathAndFilename when creating a new ViewFactoryData - but not afterwards.

My code looks the same as the migration example in the link above.

Actions #3

Updated by Simon Praetorius about 1 month ago ยท Edited

Because we're continually decoupling Fluid from the Core, extensions need to start differentiating between View implementations as well. This will probably be a bit more seamless in the future, but for now we also use instanceof checks in the core, for example in ExtBase internals. So I'd suggest to use something like this in your case:

if ($view instanceof FluidViewAdapter) {
    $view->getRenderingContext()->getTemplatePaths()->setTemplatePathAndFilename($yourTemplate);
}

You can also use setTemplateRootPaths on that object and return the template name, that would probably be even cleaner.

Actions #4

Updated by Christian Kuhn 30 days ago

  • Related to Feature #104773: Implement and use a core ViewFactoryInterface added
Actions #5

Updated by Gerrit Code Review 30 days ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86209

Actions #6

Updated by Christian Kuhn 30 days ago

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

Updated by Benni Mack 5 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF