I recently installed the Processwire Dashboard module (https://daun.github.io/processwire-dashboard/#/). After I added the hook code in site/templates/admin.php, even though I can see the dashboard, the 'Pages' page shows this error -
Fatal error: Cannot redeclare _checkForMaxInputVars() (previously declared in wire/core/admin.php:line 96).'
When I try to add a panel to show the Pagelist or simply try to access the subpages of any parent page, I see this error too. This error disappears when I remove the hook code from sites/templates/admin.php file. The code that the Dashboard module suggests we add to this file is as follows:
wire()->addHookAfter('Dashboard::getPanels', function ($event) {
/* Get list of panels */
$panels = $event->return;
/* Add panels */
$panels->add([
'panel' => 'collection',
'title' => 'News items',
'data' => [
'collection' => 'template=news-item, limit=10',
'sortable' => true,
],
]);
});
/* Make sure to add the hook *before* the default admin process */
require $config->paths->adminTemplates . 'controller.php';
Any suggestions on how to solve this?
Thanks.