The dashboard works as a separate module. As with any other module, download the code, put it in a subfolder and call /dev/build to rebuild the class manifest.
Viewing the Toolbar
The Toolbar is accessible under yoursite/DeveloperDashboard/
By default (when no custom tabs have been added), it will display three tabs:
- Tools, showing debug functionality,
- Logs, showing log information that was written using DashboardLogWriter and
- Files, showing the content of log files.
Viewing log messages
The logs tab displays log messages that have been created by log streams within the current session (see Logging).
Each stream has a control button. Clicking on the button, it is possible to hide information from a stream:
Displaying log files
Any log file that should be displayed has to be registered first by calling
DashboardLogFile::registerLogFile. Note that the file has to exist at the time that
registerLogFile is called.
DashboardLog::get_log_wrapper is called with the parameter
$copyToFile set to true, it will also register a log file.
To add your own fields to the Dashboard, do the following:
- Create a DashboardPanel instance.
- Call addFormField to add FormField instances (including FormAction's).
- Add the DashboardPanel to the DeveloperDashboard by calling add_panel.
If you have a form action and want to be notified when its action is triggered, it is neccessary to provide a callback function to addFormField. The easiest way to do this, is if you call addFormField from within a Controller.
If the controller that you are in has a method of the same name as the FormAction, you only need to call
addFormField(new FormAction('somename',...), $this). The Form will automatically find that method. If the controller does not have such a method, you need to provide the method name, by calling
addFormField(new FormAction(...), $this, 'myMethodName').
Using the update content callback
In some cases, the information you want to display is not available during initialization. This might happen if you try to access Session or the database. For this case, you can register a callback using
setFormContentCallback($controller). Before the form is displayed,
$controller->getPanelContent($panel) will be executed, allowing to add more fields to the panel using
$panel->addFormField(). It is also possible to access the existing fields using
Logging for more information about how to generate and filter log information.