PHP Класс Piwik\Widget\WidgetsList

Widgets are added through the {@hook WidgetsList.addWidgets} and filtered through the {@hook Widgets.filterWidgets} event. Observers for this event should call the {@link addWidget()} method to add widgets or use any of the other methods to remove widgets.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
addToContainerWidget ( string $containerId, WidgetConfig $widget ) Add a widget to a widget container. It doesn't matter whether the container was added to this list already or whether the container is added later. As long as a container having the same containerId is added at some point the widget will be added to that container. If no container having this id is added the widget will not be recognized.
addWidgetConfig ( WidgetConfig $widget ) Adds a new widget to the widget config. Please make sure the widget is enabled before adding a widget as no such checks will be performed.
addWidgetConfigs ( WidgetConfig[] $widgets ) Add multiple widget configs at once. See {@link addWidgetConfig()}.
get ( ) : static Get all widgets defined in the Piwik platform.
getWidgetConfigs ( ) : WidgetConfig[] Get all added widget configs.
getWidgetUniqueId ( $controllerName, $controllerAction, array $customParameters = [] ) : string CAUTION! If you ever change this method, existing updates will fail as they currently use that method! If you change the output the uniqueId for existing widgets would not be found anymore
isDefined ( string $module, string $action ) : boolean Returns true if a widget exists in the widget list, false if otherwise.
remove ( string $widgetCategoryId, string | false $widgetName = false ) Removes one or more widgets from the widget list.

Приватные методы

Метод Описание
addContainer ( WidgetContainerConfig $containerWidget )
checkIsValidWidget ( WidgetConfig $widget )

Описание методов

addToContainerWidget() публичный Метод

Add a widget to a widget container. It doesn't matter whether the container was added to this list already or whether the container is added later. As long as a container having the same containerId is added at some point the widget will be added to that container. If no container having this id is added the widget will not be recognized.
public addToContainerWidget ( string $containerId, WidgetConfig $widget )
$containerId string eg 'Products' or 'Contents'. See {@link WidgetContainerConfig::setId}
$widget WidgetConfig

addWidgetConfig() публичный Метод

Adds a new widget to the widget config. Please make sure the widget is enabled before adding a widget as no such checks will be performed.
public addWidgetConfig ( WidgetConfig $widget )
$widget WidgetConfig

addWidgetConfigs() публичный Метод

Add multiple widget configs at once. See {@link addWidgetConfig()}.
public addWidgetConfigs ( WidgetConfig[] $widgets )
$widgets WidgetConfig[]

get() публичный статический Метод

Get all widgets defined in the Piwik platform.
public static get ( ) : static
Результат static

getWidgetConfigs() публичный Метод

Get all added widget configs.
public getWidgetConfigs ( ) : WidgetConfig[]
Результат WidgetConfig[]

getWidgetUniqueId() публичный статический Метод

Returns the unique id of an widget with the given parameters
public static getWidgetUniqueId ( $controllerName, $controllerAction, array $customParameters = [] ) : string
$controllerName
$controllerAction
$customParameters array
Результат string

isDefined() публичный Метод

Returns true if a widget exists in the widget list, false if otherwise.
public isDefined ( string $module, string $action ) : boolean
$module string The controller name of the widget.
$action string The controller action of the widget.
Результат boolean

remove() публичный Метод

Removes one or more widgets from the widget list.
public remove ( string $widgetCategoryId, string | false $widgetName = false )
$widgetCategoryId string The widget category id. Can be a translation token eg 'General_Visits' see {@link WidgetConfig::setCategoryId()}.
$widgetName string | false The name of the widget to remove eg 'VisitTime_ByServerTimeWidgetName'. If not supplied, all widgets within that category will be removed.