Creating a Widget

From WHMCS Documentation

Revision as of 04:52, 4 January 2017 by John (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Creating a widget is very easy to do. They can be defined as part of any hook file - be it part of a provisioning/server module, registrar module or addon module. Or even just a standalone hook file for a standalone widget on it's own.

All the widgets included in WHMCS by default are open source, and so are the ideal way to get started by following one of them as an example. You can find the default widgets in the /modules/widgets/ folder.

The basic idea is that you need to create a function, which returns an array with 2 parts - a title, and the content. The title is the name displayed for the widget, and the content is the output within the widget block. And then using the same methodology as with hooks, you define the custom function to WHMCS using a Hook call of "AdminHomeWidgets".