Strange behavior with Backend Module

Issue #34 new
Christian Ehret created an issue

Hello!

My Settings:
TYPO3 11.5.23 (Composer mode)
PHP 8.1.14
Context: Development
nnrestapi 1.4.1

I have a multisite Installation and added TYPOScript to one root page and also the yaml RouteEnhance

If I open the Backend Module I got “Sorry, just 2 more things….” TypoScript and RouteEnhancer.
If I disable the checks in the Extension Configuration and open the Module I get the following error:

#1257246929 TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException

Tried resolving a template file for controller action "Mod->index" in format ".html", but none of the paths contained the expected template file (Mod/Index.html). The following paths were checked: /path/to/public/typo3conf/ext/nnrestapi/Resources/Private/Templates/

here the “Backend” is missing at the end of the path?

I now symlinked Templates, Layouts and Partials from /public/typo3conf/ext/nnrestapi/Resources/Private/Backend/ to /public/typo3conf/ext/nnrestapi/Resources/Private/ and the Module is working.

What am I doing wrong?

For the API Calls in the module I have to enter the Backend with the domain of the site the API TypoScript is set - but that’s ok for me.

If you need any further information please let me know!

Thank you

Christian

Comments (4)

  1. David Bascom

    My current guess is that the backend Module tries to load the site configuration and typoscript that was set for the other site of your multidomain installation.

    could you try adding the typoscript setup / template to both sites and also add the yaml import to both site configurations. Does it work then?

    If yes we might need to add an option to select the site that the nnrestapi backend module should run under. This shouldn‘t be very complicated.

  2. Stig Nørgaard Færch

    I think I found the following regarding TypoScript in backend Extbase context.

    The TypoScript is found from the getCurrentPageId method of the BackendConfigurationManager.
    If the page id is not found by Get/Post data, then it is found from the getCurrentPageIdFromCurrentSiteRoot method, which returns the page id first found page where the page is marked with is_siteroot and sorted by sorting:

    SELECT `uid`
    FROM `pages`
    WHERE (`is_siteroot` = 1)
      AND (`sys_language_uid` = 0)
      AND (`t3ver_oid` = 0)
      AND (`t3ver_wsid` = 0)
      AND ((`pages`.`deleted` = 0) AND (`pages`.`hidden` = 0))
    ORDER BY `sorting` ASC
    

    This means that the page found is pretty random.

    In our multisite solution, I think we have solved it by including the TypoScript from ext_localconf.php (not ext_tables.php) instead like this:

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(
        "
        @import 'EXT:nnrestapi/Configuration/TypoScript/setup.typoscript'
        "
    );
    

    It is also important that you login to the backend with at domain where the yaml file has been included (in the site configuration).

    I think that it would be helpful, if when you login with a domain, which has no site configuration, then you get one error message. For example - “No site configuration was configured for the domain you have used to login to the backend. Therefore the required yaml file was not included.”
    If you login with another domain, where the configuration is not included, you get another error message. For example - “The required yaml file was not included in the site configuration for the domain you used to login to the backend.”
    Or something like that.

  3. Stig Nørgaard Færch

    @David Bascom Maybe it would be good to metion this alternative way of including the TypoScript in the manual and/or module?

  4. Log in to comment