Mugo Web main content.

Creating dashboard widgets in eZ Publish: disk space example widget

By: Peter Keung | February 24, 2011 | eZ Publish development tips

In eZ Publish 4.3 and higher, the default Administration Interface landing page after a user has logged in is the dashboard. On this dashboard is a listing of widgets, such as a list of the latest edited content. It is very simple to add a new widget to this dashboard, and we've built an example widget -- showing the server's disk space information -- to illustrate this.

Our extension "mugodiskspace" can be downloaded here. The purpose of it is to place statistics about the server's disk space directly on your eZ Publish dashboard (or in any template you want). We decided to develop this extension after a few cases where clients' eZ Publish installations were mysteriously behaving erratically, and the cause was that their servers had run out of space. Since that would probably not be the first thing you would expect when it happens, this dashboard widget is helpful to alert users before the unexpected happens!

Mugo Disk Space widget screenshot

The extension has a few simple components:

To tell eZ Publish to look for dashboard widgets in this extension:


The main settings/dashboard.ini configuration file has a good, simple explanation of what configuration settings are available:

# DashboardBlocks[]=example

# [DashboardBlock_example]
# By default system will load /dashboard/[block_identifier].tpl template
# e.g if INI group is called [Dashboard_example] then system will load /dashboard/example.tpl file
# If Template variable is specified then it will be used instead of default location
# Template=example.tpl

# Priority determines the order in which the blocks will be rendered
# Priority=10

# List of policies, either in "<node_id>" or "<module>/<function>" form
# In case of node id, content/read is checked!
# PolicyList[]

# Controls how many items are fetched and displayed in the dashboard block
# Value available as a {$block.number_of_items} variable
# NumberOfItems=10

Of particular interest is the PolicyList[] setting. In our extension, we simply set this to be "content/read", essentially meaning that if the user has managed to log in to the Adminstration Interface, they can see the widget. However, you can make full use of the eZ Publish permission system to limit who can see the widget.

The dashboard template, automatically included in the Administration Interface dashboard according to the above INI settings:

extension/mugodiskspace/settings/design.ini.append.php (to tell eZ Publish to look for templates in this extension)
extension/mugodiskspace/settings/mugodiskspace.ini.append.php (which contains a setting to determine the paths for which we should display disk space information)

The template operator, which the dashboard template uses:

extension/mugodiskspace/settings/site.ini.append.php (to tell eZ Publish to look for template operators in this extension)

And that's all! Click here to download the Mugo Disk Space dashboard widget extension.


blog comments powered by Disqus