Orchard Core has a feature, called Admin Dashboard, that can be enabled and disabled by an Orchard Core website administrator. The Admin Dashboard feature converts the fairly empty space displayed after logging into the admin section into a manageable workspace that can be organized with Dashboard Widgets. Administrators can place, position, and resize any available dashboard widgets on the new dashboard. These dashboard widgets are very similar to frontend widgets with only a few minor differences. An Orchard Core developer that is familiar with developing custom widgets for the Orchard Core frontend can easily begin developing dashboard widgets, opening up a whole new world of development opportunities.
In this Orchard Core tutorial I will introduce the new Admin Dashboard feature and mention a few notable differences when developing a dashboard widget compared to a widget displayed on the frontend.
Admin Dashboard in Orchard Core
As mentioned above, Admin Dashboard is a feature that can be turned on and off by an Orchard Core administrator by navigating to Configuration -> Features. The feature is located in the Content Management section and can be easily filtered by its name, Admin Dashboard.
If you are an Orchard Core developer developing custom dashboard widgets, make sure the custom module associated with the dashboard widget has a dependencies on the Admin Dashboard feature. This makes sure the feature is enabled and the custom dashboard widget can be displayed on the admin dashboard.
HTML Dashboard Widget
The Admin Dashboard feature creates an example HTML Dashboard Widget when enabled from the backend. As an administrator you are free to edit, delete, and publish/unpublish the sample dashboard widget as well as add additional HTML dashboard widgets.
Show below is a sample HTML dashboard widget that I created for the admin dashboard. You can see the controls and menu that allow an administrator to position the widget as well as edit, delete, and publish/unpublish it. It is also possible to resize the dashboard widget by increasing or decreasing its height and width.
Admin Dashboard Widget Fundamentals
There are essentially 3 things to know when creating dashboard widgets for the Orchard Core admin.
- Dashboard widgets have a special stereotype of DashboardWidget
- The DashboardPart must be attached to the Dashboard Widget
- The display type for a dashboard widget is DetailAdmin
If you’re an Orchard Core developer, you will notice the similarities to frontend widgets, except for the need for a DashboardPart. The DashboardPart allows the dashboard widget to hold information about the size and location of the widget for placement on the admin dashboard. Just like widgets have a stereotype of Widget, dashboard widgets have a stereotype of DashboardWidget. And last, dashboard widgets have a display type of DetailAdmin rather than Detail, but there is currently some discussions about whether this will be the case in the future when the feature is released in production.
Custom Admin Dashboard Widget
Armed with the above information, it is easy to develop custom admin dashboard widgets for Orchard Core. Shown below is a sample dashboard widget that I developed to display chart data in Orchard Core. This is one of a few dashboard widgets that I use when training new Orchard Core developers on the Admin Dashboard feature.
Aside from the three notable differences mentioned above, developing dashboard widgets for Orchard Core is not much different than creating custom widgets for the frontend. If you're an Orchard Core developer, I recommend enabling the Admin Dashboard feature and experimenting with the provided HTML Dashboard Widget. After that, create your own custom admin dashboard widgets for Orchard Core to get a feel for the similarities and differences of developing frontend widgets.