Typoscript doesn't seem to work
mewcrazy opened this issue · 5 comments
Hi Oliver,
I know this isn't really a bug related to your extension, but I tried to create my own dashboard, widget group and widget according to your example extension. So far everything is working as expected. But the widget doesn't seem to use the Templates defined in TypoScript.
I use the following TypoScript, but the templates are not showing up.
`
Dashboard
module.tx_dashboard {
view {
templateRootPaths {
111 = EXT:my_extension/Resources/Private/Templates/Dashboard/Widgets/
}
partialRootPaths {
111 = EXT:my_extension/Resources/Private/Partials/Dashboard/Widgets/
}
}
}`
Do you have any idea what other steps are neccessary to get the widget templates up and running?
Kind Regards,
Dennis Bitsch
Hi, there could be a couple of reasons. So some question from my side:
- How do you include the TypoScript?
- Do you correctly set the template in your widget?
- Have you checked whether the paths are correct?
- Do you get any error message / exception?
Hi, thanks for taking the time.
- First I tried my main setup.typoscript -> no effect, then I tried Template->Setup of my root page -> also no effect.
- I think so. In my renderWidgetContent() method in RecentOrdersWidget.php I got the following: $this->view->setTemplate('Widget/RecentOrdersWidget');
- The above paths are definitly correct. After looking at the error message it seems as if there are no paths set at all.
- Yes, take a look:
Btw: I'm using TYPO3 v11. Maybe something changed?
The above paths are definitly correct. After looking at the error message it seems as if there are no paths set at all.
Are the core widgets working?
Could you please try to include the TypoScript globally with ExtensionManagementUtility::addTypoScriptSetup()
in your ext_localconf.php
, like done by this extension: https://github.com/o-ba/custom_dashboard_widgets/blob/main/ext_localconf.php#L8
Hi, well I tried to include it via addTypoScriptSetup() - But the result is the same as with ::addStaticFile().
But then I had a lucky find while looking at the StandaloneView class. It's possible to set the Template/Layout/Partial Paths via PHP. And it worked right away. The widget is showing up.
$this->view->setTemplateRootPaths(['EXT:ext/Resources/Private/Templates/Dashboard/']);
$this->view->setLayoutRootPaths(['EXT:ext/Resources/Private/Templates/Dashboard/']);
$this->view->setPartialRootPaths(['EXT:ext/Resources/Private/Templates/Dashboard/']);
Thanks again for the help 👌
Sorry, but this is not done. My typoscript is shown in Backend but the path to the template is not taken.