Backend\Classes\WidgetManager


Protected Properties

protected System\Classes\PluginManager $pluginManager

protected array $formWidgets

formWidgets stored in the form of ['FormWidgetClass' => $formWidgetInfo]

protected array $formWidgetCallbacks

formWidgetCallbacks cache

protected array $formWidgetHints

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

protected array $filterWidgets

protected array $filterWidgetCallbacks

filterWidgetCallbacks cache

protected array $filterWidgetHints

filterWidgetHints keyed by their code. Stored in the form of ['filterwidgetcode' => 'FilterWidgetClass'].

protected array $reportWidgets

protected array $reportWidgetCallbacks

reportWidgetCallbacks cache


Public Methods

public __construct()

public __construct(): void

__construct this class

public getFilterWidgets()

public getFilterWidgets(): array 

getFilterWidgets returns the raw array of registered filter widgets.

public getReportWidgets()

public getReportWidgets(): array 

getReportWidgets returns the raw array of registered report widgets.

public static instance()

public static instance(): static 

instance creates a new instance of this singleton

public listFilterWidgets()

public listFilterWidgets(): array 

listFilterWidgets returns a list of registered filter widgets.

public listFormWidgets()

public listFormWidgets(): array 

listFormWidgets returns a list of registered form widgets.

public listReportWidgets()

public listReportWidgets(): array 

listReportWidgets returns a list of registered report widgets.

public registerFilterWidget()

public registerFilterWidget($className, $widgetInfo): void

public registerFilterWidgets()

public registerFilterWidgets($definitions): void

registerFilterWidgets manually registers filter widget for consideration. Usage:

WidgetManager::registerFilterWidgets(function ($manager) {
    $manager->registerFilterWidget(\Backend\FilterWidgets\DateRange::class, 'daterange');
});

public registerFormWidget()

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

registerFormWidget registers a single form widget.

public registerFormWidgets()

public registerFormWidgets($definitions): void

registerFormWidgets manually registers form widget for consideration. Usage:

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

public registerReportWidget()

public registerReportWidget($className, $widgetInfo): void

public registerReportWidgets()

public registerReportWidgets($definitions): void

registerReportWidgets manually registers report widget for consideration. Usage:

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

public removeReportWidget()

public removeReportWidget(string $className): void 

removeReportWidget removes a registered ReportWidget.

public resolveFilterWidget()

public resolveFilterWidget(string $name): string 

resolveFilterWidget returns a class name from a filter widget code Normalizes a class name or converts an code to its class name.

public resolveFormWidget()

public resolveFormWidget(string $name): string 

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