Method |
Description |
|
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. |
|