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.
Array keys are class names.
public listFormWidgets () : array
Returns a list of registered form widgets.
Array keys are class names.
public listReportWidgets () : array
Returns a list of registered report widgets.
Array keys are class names.
public
registerFormWidget (string $className, array $widgetInfo = null
)
: void
Registers a single form widget.
Property | Type | Description |
---|---|---|
$className | string |
string
Widget class name. |
$widgetInfo | array |
array
Registration information, can contain a |
public registerFormWidgets (callable $definitions)
Manually registers form widget for consideration. Usage:
WidgetManager::registerFormWidgets(function ($manager) { $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor'); });
Property | Type | Description |
---|---|---|
$definitions | callable |
callable
|
public registerReportWidget ($className, $widgetInfo)
Property | Type | Description |
---|---|---|
$className | mixed |
mixed
|
$widgetInfo | mixed |
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' ]); });
Property | Type | Description |
---|---|---|
$definitions | callable |
callable
|
public removeReportWidget (string $className) : void
Remove a registered ReportWidget.
Property | Type | Description |
---|---|---|
$className | string |
string
Widget class name. |
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.
Property | Type | Description |
---|---|---|
$name | string |
string
Class name or form widget code. |
The class name resolved, or the original name.
protected init ()
Initialize this singleton.
inherited public __clone ()
inherited public __wakeup ()
inherited
public
static
final
forgetInstance ($container = null
)
: void
Forget this singleton's instance if it exists
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
inherited
public
static
final
instance ($container = null
)
: static
Create a new instance of this singleton.
Property | Type | Description |
---|---|---|
$container | mixed |
mixed
|
inherited protected final __construct ()
Constructor.