Difference between revisions of "Creating a Widget"
m (added activation after uploading) |
|||
Line 3: | Line 3: | ||
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. | 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". | + | 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". |
− | < | + | <div class="docs-alert-info"> |
− | < | + | <span class="title">Note</span><br /> |
− | + | Sample code can be found at [http://developers.whmcs.com/addon-modules/admin-dashboard-widgets/ http://developers.whmcs.com/addon-modules/admin-dashboard-widgets/] | |
− | + | </div> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 10:52, 4 January 2017
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".
Note
Sample code can be found at http://developers.whmcs.com/addon-modules/admin-dashboard-widgets/