WidgetManager

Widget manager

 class Backend\Classes\WidgetManager

Traits

Trait Description
Singleton

Singleton trait.

Properties

protected $formWidgetCallbacks : array

Cache of form widget registration callbacks.

protected $formWidgetHints : array

An array of form widgets keyed by their code. Stored in the form of ['formwidgetcode' => 'FormWidgetClass'].

protected $formWidgets : array

An array of form widgets. Stored in the form of ['FormWidgetClass' => $formWidgetInfo].

protected $pluginManager : System\Classes\PluginManager

protected $reportWidgetCallbacks : array

Cache of report widget registration callbacks.

protected $reportWidgets : array

An array of report widgets.

Methods

public getReportWidgets () : array

Returns the raw array of registered report widgets.

Returns
array

Array keys are class names.

public listFormWidgets () : array

Returns a list of registered form widgets.

Returns
array

Array keys are class names.

public listReportWidgets () : array

Returns a list of registered report widgets.

Returns
array

Array keys are class names.

public registerFormWidget (string $className, array $widgetInfo = null) : void

Registers a single form widget.

Parameters
Property Description
$className
string

Widget class name.

$widgetInfo
array

Registration information, can contain a code key.

Returns
void

public registerFormWidgets (callable $definitions)

Manually registers form widget for consideration. Usage:

WidgetManager::registerFormWidgets(function ($manager) { $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor'); });

Parameters
Property Description
$definitions
callable
Returns
mixed

public registerReportWidget ($className, $widgetInfo)

Parameters
Property Description
$className
mixed
$widgetInfo
mixed
Returns
mixed

public registerReportWidgets (callable $definitions)

Manually registers report widget for consideration. Usage:

WidgetManager::registerReportWidgets(function ($manager) { $manager->registerReportWidget('Winter\GoogleAnalytics\ReportWidgets\TrafficOverview', [ 'name' => 'Google Analytics traffic overview', 'context' => 'dashboard' ]); });

Parameters
Property Description
$definitions
callable
Returns
mixed

public removeReportWidget (string $className) : void

Remove a registered ReportWidget.

Parameters
Property Description
$className
string

Widget class name.

Returns
void

public resolveFormWidget (string $name) : string

Returns a class name from a form widget code Normalizes a class name or converts an code to its class name.

Parameters
Property Description
$name
string

Class name or form widget code.

Returns
string

The class name resolved, or the original name.

protected init ()

Initialize this singleton.

Returns
mixed

inherited public __clone ()

Inherited from Singleton
Returns
mixed

inherited public __wakeup ()

Inherited from Singleton
Returns
mixed

inherited public static final forgetInstance ($container = null) : void

Inherited from Singleton

Forget this singleton's instance if it exists

Parameters
Property Description
$container
mixed
Returns
void

inherited public static final instance ($container = null) : static

Inherited from Singleton

Create a new instance of this singleton.

Parameters
Property Description
$container
mixed
Returns
static

inherited protected final __construct ()

Inherited from Singleton

Constructor.

Returns
mixed
Copyright © 2024 Winter CMS