Nextcloud PHP API (stable18)

IDashboardWidget

Interface IDashboardWidget

This interface is used to create a widget: the widget must implement this interface and be defined in appinfo/info.xml:

<dashboard> <widget>OCA\YourApp\YourWidget</widget> </dashboard>

Multiple widget can be defined in the same appinfo/info.xml.

Tags
since
15.0.0

Table of Contents

getDescription()  : string
Should returns some text describing the widget.
getId()  : string
Should returns the (unique) Id of the widget.
getName()  : string
Should returns the [display] name of the widget.
getWidgetSetup()  : WidgetSetup
Must create and return a WidgetSetup containing the general setup of the widget
getWidgetTemplate()  : WidgetTemplate
Must generate and return a WidgetTemplate that define important stuff about the Widget: icon, content, css or javascript.
loadWidget()  : mixed
This method is called when a widget is loaded on the dashboard.
requestWidget()  : mixed
This method s executed when the widget call the net.requestWidget() from the Javascript API.

Methods

getDescription()

Should returns some text describing the widget.

public getDescription() : string

This description is displayed in the listing of the available widgets.

Tags
since
15.0.0
Return values
string

getId()

Should returns the (unique) Id of the widget.

public getId() : string
Tags
since
15.0.0
Return values
string

getName()

Should returns the [display] name of the widget.

public getName() : string
Tags
since
15.0.0
Return values
string

loadWidget()

This method is called when a widget is loaded on the dashboard.

public loadWidget(IWidgetConfig $settings) : mixed

A widget is 'loaded on the dashboard' when one of these conditions occurs:

  • the user is adding the widget on his dashboard,
  • the user already added the widget on his dashboard and he is opening the dashboard app.
Parameters
$settings : IWidgetConfig
Tags
see
IWidgetConfig
since
15.0.0
Return values
mixed

requestWidget()

This method s executed when the widget call the net.requestWidget() from the Javascript API.

public requestWidget(IWidgetRequest $request) : mixed

This is used by the frontend to communicate with the backend.

Parameters
$request : IWidgetRequest
Tags
see
IWidgetRequest
since
15.0.0
Return values
mixed

Search results