- Affected version
- 2.0.0 beta 1
In a custom widget, I want to render a template and pass it as a parameter to the widget template.
My widget render function looks something like this
It works fine except in position 'Public: sidebar top' and 'Public: sidebar bottom', it throws an error
It expects me to type 'public:example_template'.. which is unexpected as this isn't an issue in other sidebar positions.
My widget render function looks something like this
PHP:
...
class Widget extends AbstractWidget
{
...
public function render()
{
...
$viewParams = [
...
'latest_posts' => $this->app->templater()->renderTemplate('example_template', [...]),
];
return $this->renderer('widget_example_name', $viewParams);
}
}
It works fine except in position 'Public: sidebar top' and 'Public: sidebar bottom', it throws an error
PHP:
An exception occurred: [ErrorException] No template type was provided. Provide template name in type:name format. in C:\www\xf2\src\XF\Template\Templater.php on line 1104