PHP Класс Piwik\Widget\WidgetConfig

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$action
$categoryId
$isEnabled
$isWide
$isWidgetizable
$middlewareParameters
$module
$name
$order
$parameters
$subcategoryId

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

Метод Описание
addParameters ( array $parameters ) : static Add new parameters and only overwrite parameters that have the same name. See {@link setParameters()}
checkIsEnabled ( ) This method checks whether the widget is available, see {@link isEnabled()}. If not, it triggers an exception containing a message that will be displayed to the user. You can overwrite this message in case you want to customize the error message. Eg.
disable ( ) Disables the widget. See {@link isEnabled()}
enable ( ) Enables the widget. See {@link isEnabled()}
getAction ( ) : string Get the currently set action.
getCategoryId ( ) : string Get the id of the category the widget belongs to.
getMiddlewareParameters ( ) : array Get defined middleware parameters (if any).
getModule ( )
getName ( ) : string Get the name of the widget.
getOrder ( ) : integer Returns the order of the widget.
getParameters ( ) : array Get all URL parameters needed to render this widget.
getSubcategoryId ( ) : string Get the currently set category ID.
getUniqueId ( ) : string Returns the unique id of an widget based on module, action and the set parameters.
isEnabled ( ) : boolean Defines whether a widget is enabled or not. For instance some widgets might not be available to every user or might depend on a setting (such as Ecommerce) of a site. In such a case you can perform any checks and then return true or false. If your report is only available to users having super user access you can do the following: return Piwik::hasUserSuperUserAccess();
isWide ( ) : boolean Detect whether the widget should be shown wide or not.
isWidgetizeable ( ) : boolean Detect whether the widget is widgetizable meaning it won't be able to add it to the dashboard and it won't be possible to export the widget via an iframe if it is not widgetizable. This is usually not needed but useful when you eg want to display a widget within the Piwik UI but not want to have it widgetizable.
setAction ( string $action ) : static Set the action of the widget that shall be used in the URL to render the widget.
setCategoryId ( string $categoryId ) : static Set the id of the category the widget belongs to.
setIsEnabled ( boolean $isEnabled ) : static Enable / disable the widget. See {@link isEnabled()}
setIsNotWidgetizable ( ) : static Sets the widget as not widgetizable {@link isWidgetizeable()}.
setIsWide ( ) Marks this widget as a "wide" widget that requires the full width.
setIsWidgetizable ( ) : static Sets the widget as widgetizable {@link isWidgetizeable()}.
setMiddlewareParameters ( array $parameters ) : static If middleware parameters are specified, the corresponding action will be executed before showing the actual widget in the UI. Only if this action (can be a controller method or API method) returns JSON true the widget will be actually shown. It is similar to isEnabled() but the specified action is performed each time the widget is requested in the UI whereas isEnabled is only checked once on the inital page load when we load the inital list of widgets. So if your widget's visibility depends on archived data (aka idSite/period/date) you should specify middle parameters. This has mainly two reasons:
setModule ( string $module ) : static Set the module (aka plugin name) of the widget. The correct module is usually detected automatically and not needed to be configured manually.
setName ( string $name ) : static Set the name of the widget.
setOrder ( integer $order ) : static Set the order of the widget.
setParameters ( array $parameters ) : static Sets (overwrites) the parameters of the widget. These parameters will be added to the URL when rendering the widget. You can access these parameters via `Piwik\Common::getRequestVar(.
setSubcategoryId ( string $subcategoryId ) : static Set the id of the subcategory the widget belongs to. If a subcategory is specified, the widget will be shown in the Piwik reporting UI. The subcategoryId will be used as a translation key for the submenu item.

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

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

Add new parameters and only overwrite parameters that have the same name. See {@link setParameters()}
public addParameters ( array $parameters ) : static
$parameters array eg. ('urlparam' => 'urlvalue')
Результат static

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

if (!$this->isEnabled()) { throw new Exception('Setting XYZ is not enabled or the user has not enough permission'); }
public checkIsEnabled ( )

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

Disables the widget. See {@link isEnabled()}
public disable ( )

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

Enables the widget. See {@link isEnabled()}
public enable ( )

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

Get the currently set action.
public getAction ( ) : string
Результат string

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

Get the id of the category the widget belongs to.
public getCategoryId ( ) : string
Результат string

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

Get defined middleware parameters (if any).
public getMiddlewareParameters ( ) : array
Результат array

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

public getModule ( )

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

Get the name of the widget.
public getName ( ) : string
Результат string

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

Returns the order of the widget.
public getOrder ( ) : integer
Результат integer

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

Get all URL parameters needed to render this widget.
public getParameters ( ) : array
Результат array Eg ('urlparam' => 'urlvalue').

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

Get the currently set category ID.
public getSubcategoryId ( ) : string
Результат string

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

Returns the unique id of an widget based on module, action and the set parameters.
public getUniqueId ( ) : string
Результат string

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

Defines whether a widget is enabled or not. For instance some widgets might not be available to every user or might depend on a setting (such as Ecommerce) of a site. In such a case you can perform any checks and then return true or false. If your report is only available to users having super user access you can do the following: return Piwik::hasUserSuperUserAccess();
public isEnabled ( ) : boolean
Результат boolean

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

Detect whether the widget should be shown wide or not.
public isWide ( ) : boolean
Результат boolean

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

Detect whether the widget is widgetizable meaning it won't be able to add it to the dashboard and it won't be possible to export the widget via an iframe if it is not widgetizable. This is usually not needed but useful when you eg want to display a widget within the Piwik UI but not want to have it widgetizable.
public isWidgetizeable ( ) : boolean
Результат boolean

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

The correct action is usually detected automatically and not needed to be configured manually.
public setAction ( string $action ) : static
$action string eg 'renderMyWidget'
Результат static

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

Set the id of the category the widget belongs to.
public setCategoryId ( string $categoryId ) : static
$categoryId string Usually a translation key, eg 'General_Visits', 'Goals_Goals', ...
Результат static

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

Enable / disable the widget. See {@link isEnabled()}
public setIsEnabled ( boolean $isEnabled ) : static
$isEnabled boolean
Результат static

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

Sets the widget as not widgetizable {@link isWidgetizeable()}.
public setIsNotWidgetizable ( ) : static
Результат static

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

Marks this widget as a "wide" widget that requires the full width.
public setIsWide ( )

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

Sets the widget as widgetizable {@link isWidgetizeable()}.
public setIsWidgetizable ( ) : static
Результат static

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

- This way the inital page load time is faster as we won't have to request archived data on the initial page load for widgets that are potentially never shown. - We execute that action every time before showing it. As the initial list of widgets is loaded on page load it is possible that some archives have no data yet, but at a later time there might be actually archived data. As we never reload the initial list of widgets we would still not show the widget even there we should. Example: On page load there are no conversions, a few minutes later there might be conversions. As the middleware is executed before showing it, we detect correctly that there are now conversions whereas isEnabled is only checked once on the initial Piwik page load.
public setMiddlewareParameters ( array $parameters ) : static
$parameters array URL parameters eg array('module' => 'Goals', 'action' => 'Conversions')
Результат static

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

Set the module (aka plugin name) of the widget. The correct module is usually detected automatically and not needed to be configured manually.
public setModule ( string $module ) : static
$module string eg 'CoreHome'
Результат static

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

Set the name of the widget.
public setName ( string $name ) : static
$name string Usually a translation key, eg 'VisitTime_ByServerTimeWidgetName'
Результат static

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

Set the order of the widget.
public setOrder ( integer $order ) : static
$order integer eg. 5
Результат static

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

..)`.
public setParameters ( array $parameters ) : static
$parameters array eg. ('urlparam' => 'urlvalue')
Результат static

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

Set the id of the subcategory the widget belongs to. If a subcategory is specified, the widget will be shown in the Piwik reporting UI. The subcategoryId will be used as a translation key for the submenu item.
public setSubcategoryId ( string $subcategoryId ) : static
$subcategoryId string Usually a translation key, eg 'General_Overview', 'Actions_Pages', ...
Результат static

Описание свойств

$action защищенное свойство

protected $action

$categoryId защищенное свойство

protected $categoryId

$isEnabled защищенное свойство

protected $isEnabled

$isWide защищенное свойство

protected $isWide

$isWidgetizable защищенное свойство

protected $isWidgetizable

$middlewareParameters защищенное свойство

protected $middlewareParameters

$module защищенное свойство

protected $module

$name защищенное свойство

protected $name

$order защищенное свойство

protected $order

$parameters защищенное свойство

protected $parameters

$subcategoryId защищенное свойство

protected $subcategoryId