Search code examples
typo3typoscriptextbasetypo3-6.2.xtypo3-extensions

TYPO3 Extbase backend module TypoScript for Fluid layout not loading


In TYPO3 CMS 6.2.17, I used Extension Builder to make an Extbase extension that has a frontend plugin and a backend module. I built a localhost website with two pages: id=1 is a standard page; and id=2 is a folder. The standard page has the site's root TypoScript template, and that template includes my extension's static file.

I activated my Extbase extension in the Web module. When I selected my extension and the folder page (id=2), I saw a populated listing display from the default controller and action; but the display was using the frontend Fluid layout, not the backend layout. I want the backend layout for its Fluid actionMenu in the "typo3-docheader-functions" div class.

I can't seem to get the backend Fluid layout for the display. I've selected the standard page (empty listing display as expected) and even the site root page (id=0) (also empty listing display), but they both use the frontend Fluid layout, too.

I've cleared all caches and cleaned typo3temp/ in the Install Tool. I've deactivated and reactivated my extension in Extension Manager. I've tried solutions suggested in TYPO3 Extbase backend module. Template path issue and even TYPO3 4.5 extbase test backend module. Nothing has worked so far. I've even gone through the site's Install Tool "all configuration" settings, but saw nothing I thought could affect the backend display problem.

The code is straight from Extension Builder, but here are some excerpts.

ext_tables.php:

if (TYPO3_MODE === 'BE') {

    /**
     * Registers a Backend Module
     */
    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
        'MyVendor.' . $_EXTKEY,
        'web',
        'myextbe',  // Submodule key
        '',                     // Position
        array(
            'Import' => 'list, show, new, create, edit, update, delete',
            'Pages' => 'list, show',
        ),
        array(
            'access' => 'user,group',
            'icon'   => 'EXT:' . $_EXTKEY . '/ext_icon.gif',
            'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_myextbe.xlf',
        )
    );

}

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'My Ext');

myext\Configuration\TypoScript\constants.txt:

module.tx_myext_myextbe {
    view {
        # cat=module.tx_myext_myextbe/file; type=string; label=Path to template root (BE)
        templateRootPath = EXT:myext/Resources/Private/Backend/Templates/
        # cat=module.tx_myext_myextbe/file; type=string; label=Path to template partials (BE)
        partialRootPath = EXT:myext/Resources/Private/Backend/Partials/
        # cat=module.tx_myext_myextbe/file; type=string; label=Path to template layouts (BE)
        layoutRootPath = EXT:myext/Resources/Private/Backend/Layouts/
    }
    persistence {
        # cat=module.tx_myext_myextbe//a; type=string; label=Default storage PID
        storagePid =2
    }
}

myext\Configuration\TypoScript\setup.txt:

 # Module configuration
module.tx_myext_myextbe {
    persistence {
        storagePid = {$module.tx_myext_myextbe.persistence.storagePid}
    }
    view {
        templateRootPath = {$module.tx_myext_myextbe.view.templateRootPath}
        partialRootPath = {$module.tx_myext_myextbe.view.partialRootPath}
        layoutRootPath = {$module.tx_myext_myextbe.view.layoutRootPath}
    }
}

Solution

  • Replace all module.tx_myext_myextbe to module.tx_myext and plugin.tx_myext_myextfe to plugin.tx_myext.

    module.tx_myext_myextbe is invalid notation in 6.2.x - in the result Extbase can't find it and tries the default template path which is frontend one

    constants.txt

    module.tx_myext {
        view {
            # cat=module.tx_myext/file; type=string; label=Path to template root (BE)
            templateRootPath = EXT:myext/Resources/Private/Backend/Templates/
            # cat=module.tx_myext/file; type=string; label=Path to template partials (BE)
            partialRootPath = EXT:myext/Resources/Private/Backend/Partials/
            # cat=module.tx_myext/file; type=string; label=Path to template layouts (BE)
            layoutRootPath = EXT:myext/Resources/Private/Backend/Layouts/
        }
        persistence {
            # cat=module.tx_myext//a; type=string; label=Default storage PID
            storagePid = 2
        }
    }
    

    setup.txt

    module.tx_myext {
        persistence {
            storagePid = {$module.tx_myext.persistence.storagePid}
        }
        view {
            templateRootPath = {$module.tx_myext.view.templateRootPath}
            partialRootPath = {$module.tx_myext.view.partialRootPath}
            layoutRootPath = {$module.tx_myext.view.layoutRootPath}
        }
    }
    

    TypoScript Object browser

    [module]
      [tx_myext]
       [view]
        [templateRootPath] = EXT:myext/Resources/Private/Backend/Templates/
        [partialRootPath] = EXT:myext/Resources/Private/Backend/Partials/
        [layoutRootPath] = EXT:myext/Resources/Private/Backend/Layouts/