Nextcloud PHP API (stable19)

WidgetTemplate implements JsonSerializable

Interface WidgetTemplate

A widget must create an WidgetTemplate object and returns it in the IDashboardWidget::getWidgetTemplate method.

Tags
see
IDashboardWidget::getWidgetTemplate
since
15.0.0

Interfaces, Classes and Traits

JsonSerializable

Table of Contents

$content  : string
$css  : array
$function  : string
$icon  : string
$js  : array
$settings  : \OCP\Dashboard\Model\WidgetSetting[]
addCss()  : WidgetTemplate
Add a CSS file to be included when displaying a widget.
addJs()  : WidgetTemplate
Add a JS file to be included when loading a widget.
addSetting()  : WidgetTemplate
Add a WidgetSetting.
getContent()  : string
Get the HTML file that contains the content of the widget.
getCss()  : array
Get CSS files to be included when displaying a widget
getIcon()  : string
Get the icon class of the widget.
getInitFunction()  : string
Get the JS function to be called when loading the widget.
getJs()  : array
Get JS files to be included when loading a widget
getSetting()  : WidgetSetting
Get a WidgetSetting by its name
getSettings()  : \OCP\Dashboard\Model\WidgetSetting[]
Get all WidgetSetting defined for the widget.
jsonSerialize()  : array
setContent()  : WidgetTemplate
Set the HTML file that contains the content of the widget.
setCss()  : WidgetTemplate
path and name of CSS files
setIcon()  : WidgetTemplate
Set the icon class of the widget.
setInitFunction()  : WidgetTemplate
JavaScript function to be called when loading the widget on the dashboard
setJs()  : WidgetTemplate
Set an array of JS files to be included when loading a widget.
setSettings()  : WidgetTemplate
Define all WidgetSetting for the widget.

Properties

$settings

private \OCP\Dashboard\Model\WidgetSetting[] $settings = []

Methods

getContent()

Get the HTML file that contains the content of the widget.

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

getCss()

Get CSS files to be included when displaying a widget

public getCss() : array
Tags
since
15.0.0
Return values
array

getIcon()

Get the icon class of the widget.

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

getInitFunction()

Get the JS function to be called when loading the widget.

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

getJs()

Get JS files to be included when loading a widget

public getJs() : array
Tags
since
15.0.0
Return values
array

getSetting()

Get a WidgetSetting by its name

public getSetting(string $key) : WidgetSetting
Parameters
$key : string
Tags
see
WidgetSetting::setName
since
15.0.0
Return values
WidgetSetting

getSettings()

Get all WidgetSetting defined for the widget.

public getSettings() : \OCP\Dashboard\Model\WidgetSetting[]
Tags
see
WidgetSetting
since
15.0.0
Return values
\OCP\Dashboard\Model\WidgetSetting[]

jsonSerialize()

public jsonSerialize() : array
Tags
since
15.0.0
Return values
array

setContent()

Set the HTML file that contains the content of the widget.

public setContent(string $content) : WidgetTemplate
Parameters
$content : string
Tags
since
15.0.0
Return values
WidgetTemplate

setIcon()

Set the icon class of the widget.

public setIcon(string $icon) : WidgetTemplate

This class must be defined in one of the CSS file used by the widget.

Parameters
$icon : string
Tags
see
addCss
since
15.0.0
Return values
WidgetTemplate

setInitFunction()

JavaScript function to be called when loading the widget on the dashboard

public setInitFunction(string $function) : WidgetTemplate
Parameters
$function : string
Tags
since
15.0.0
Return values
WidgetTemplate

setSettings()

Define all WidgetSetting for the widget.

public setSettings(\OCP\Dashboard\Model\WidgetSetting[] $settings) : WidgetTemplate
Parameters
$settings : \OCP\Dashboard\Model\WidgetSetting[]
Tags
since
15.0.0
see
WidgetSetting
Return values
WidgetTemplate

Search results