最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - TYPO3 BackendCustom Tab Rendering - Stack Overflow

programmeradmin0浏览0评论

This might be a really ambitious task.

I try to extend the function "renderTabMenu" from "vendor/typo3/cms-backend/Classes/Form/Container/AbstractContainer.php" with my own templates.

The problem is that there is no built in solution for this though the templates are kinda hardwired. (comment in source code)
I've already tried to find a solution via event listeners or extend the child class TabsContainer but without success so far.

Here's the function for the template rendering.

protected function renderTabMenu(array $menuItems, $domId, $defaultTabIndex = 1)
    {
        // @todo: It's unfortunate we're using Typo3Fluid TemplateView directly here. We can't
        //        inject BackendViewFactory here since __construct() is polluted by NodeInterface.
        //        Remove __construct() from NodeInterface to have DI, then use BackendViewFactory here.
        $view = GeneralUtility::makeInstance(TemplateView::class);
        $templatePaths = $view->getRenderingContext()->getTemplatePaths();
        $templatePaths->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates')]);
        $templatePaths->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials')]);
        $view->assignMultiple([
            'id' => $domId,
            'items' => $menuItems,
            'defaultTabIndex' => $defaultTabIndex,
            'wrapContent' => false,
            'storeLastActiveTab' => true,
        ]);
        return $view->render('Form/Tabs');
    }

My goal is to use my own partial for the backend tab rendering located at
Resources/Private/Backend/Partials/ModuleTemplate/Tabs.html

Does anyone got an idea how to do this?

发布评论

评论列表(0)

  1. 暂无评论