Dashboard Widget Authoring

Jan 7, 2021
98
15
8
45
Hello,
We've clobbered together some PHP that renders a table of recent customer invoices, but have yet to figure out how make a 'Dashboard Widget' show it's output or find any documentation pointint to how. Any and all help/pointers would be greatly appreciated, even if its just that your google foo is better than mine.
 
I don't think there is any documentation on how to create a dashboard widget.

Within your app/invoices directory create resources and dashboard directories. Add your PHP inside the dashboard directory.


Code:
mkdir invoices/resources/
mkdir invoices/resources/dashboard/
Chown the directories and files
 
Thanks, I tried placing our php there (/resources/dashboard/ of 'account_status' under app) and updating dashboard_url of v_dashboard to point to the new location but still nothing renders on the dashboard page. Will try again later and maybe open a ticket.
 
You also need a config.php. Look at the existing dashboard widgets so you will know how to add the code to that page.
 
Thanks whut, got it working incorporating both your suggestions, was easy in hindsight but boy was I confused. For anyone finding this in the future:

1) Place content producing php in <FUSIONHOME>/<APPNAME>/resources/dashboard/<WIDGETNAME>.php
2) Place config.php next to the content producing php, mine was minimal and will be posted redacted below
3) Use UI to add widget and point its path to <APPNAME>/<WIDGETNAME> which should populate automagically if 1 and 2 are done (thanks whut!!!)


My redacted config.php:
<?php

$array['dashboard'][$x]['dashboard_uuid'] = '0';
$array['dashboard'][$x]['dashboard_name'] = 'Account Status';
$array['dashboard'][$x]['dashboard_path'] = 'account_status/outstanding_invoices';
$array['dashboard'][$x]['dashboard_order'] = '1';
$array['dashboard'][$x]['dashboard_enabled'] = 'true';
$array['dashboard'][$x]['dashboard_description'] = 'Account Status';
$y = 0;
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = '1
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = '0';
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = 'superadmin';

?>
 
:cool::cool:

I had to do a lot of investigation when building my first dashboard widget. It is much easier to display every widget after the first one!

:)