The dashboard is a very important part of the back-end of the CMS. It's the first thing your client will see when he logs into the backend. In asgard, your modules can define a set of widgets that will be displayed on the dashboard. These widgets can be simple counts, tables, or pretty much whatever you want.
Widgets location are saved on a per user basis. Each logged in user with the correct permissions can re-arrange the widgets however he or she prefers.
Creating widgets is very easy and straightforward. A widget is composed of the following parts:
First you'll have to create a widget class that extends an abstract class:
BaseWidget. This BaseWidget class will enforce you to implement the following methods:
options (array): This is an array of options that your widget can have.
Possible options are:
view (string): Define which view needs to be used for you widget
Now you can make your widget view. You can find some inspiration on the widgets page of the Admin LTE theme.
As a final step you need to define your active widgets. To do so, you need to add a
Widgets array in your
module.json file, with an array of widget classes.
For instance, the Blog module has:
"widgets": [ "Modules\\Blog\\Widgets\\PostsWidget", "Modules\\Blog\\Widgets\\CategoriesWidget", "Modules\\Blog\\Widgets\\LatestPostsWidget" ],
Your widget will now be displayed on the dashboard.