o-ba/custom_dashboard_widgets

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

o-ba commented

Hi, there could be a couple of reasons. So some question from my side:

  1. How do you include the TypoScript?
  2. Do you correctly set the template in your widget?
  3. Have you checked whether the paths are correct?
  4. Do you get any error message / exception?

Hi, thanks for taking the time.

  1. First I tried my main setup.typoscript -> no effect, then I tried Template->Setup of my root page -> also no effect.
    image
  2. I think so. In my renderWidgetContent() method in RecentOrdersWidget.php I got the following: $this->view->setTemplate('Widget/RecentOrdersWidget');
    image
  3. The above paths are definitly correct. After looking at the error message it seems as if there are no paths set at all.
  4. Yes, take a look:
    image

Btw: I'm using TYPO3 v11. Maybe something changed?

o-ba commented

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.