See also: Writing Registry Plugins
Some additional conventions are required when writing a Dashboard Widget Plugin.
FooWidget
.CoFooWidget
model and a corresponding Controller.CoFooWidget
should extend CoDashboardWidgetBackend
, which provides some behind the scenes common functionality.SDWController
("Standard Dashboard Widget" Controller), which provides some common functionality. The controller should use $this->calculateParentPermissions($roles);
to calculate permissions for display()
, in accordance with the current user and the Dashboard's visibility.co_foo_widgets
table will be created. There is no add
operation or view required. The skeletal row will point to the parent Dashboard Widget Model.foo_widget/foo_widgets/edit/#
. This will be called immediately after the Widget is first instantiated.CoDashboardWidget
has a hasOne
(ie: 1 to 1) relationship with FooWidget
.cm_foo_widgets
should include a foreign key to cm_dashboard_widgets:id
.cm_foo_widgets:id
.The Plugin must implement CoFooWidgetsController::display($id)
, and a corresponding view CoFooWidgets/display.ctp
. These will generate the widget's content when the dashboard is rendered.
The widget should always render content, even if there is no "relevant" content to render. In such cases, render a message like "No Foos found." |
$this->CoFooWidget->getConfig()
.$this->reqCoPersonId
. Use this rather than reading session information to allow support for administrators viewing Dashboards as other users.