grantus
Active member
I created my widget definition called "test_widget".
I created a template called "test_widget_tpl".
Here's my code:
When adding my widget, I set the method to "render" but I get the error that it's not static. When I change it to static it just gives an error to try again later.
What could be the issue?
I created a template called "test_widget_tpl".
Here's my code:
Code:
namespace Test\ILL\Widgets;
use XF\Widget\AbstractWidget;
class TestWidget extends AbstractWidget {
protected $defaultOptions = [];
public function render() {
$stmt = \XF::finder('Test\ILL:Battles')
->where('status', 'active')
->order('battle', 'desc')
->limit(5)
->fetch();
$viewParams = [
'battles' => $stmt
];
return $this->renderer('test_widget_tpl', $viewParams);
}
public function verifyOptions(\XF\Http\Request $request, array &$options, &$error = null) {
return true;
}
}
When adding my widget, I set the method to "render" but I get the error that it's not static. When I change it to static it just gives an error to try again later.
What could be the issue?