PHP Class Piwik\Report\ReportWidgetFactory

.. When creating a widget from a report these values will be automatically specified so that ideally $factory->createWidget() is all one has to do in order to create a new widget.
Show file Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
__construct ( Report $report ) Generates a new report widget factory.
createContainerWidget ( string $containerId ) : WidgetContainerConfig Creates a new container widget based on the specified report in {@link construct()}.
createCustomWidget ( string $action ) : ReportWidgetConfig Creates a custom widget that doesn't use a viewDataTable to render the report but instead a custom controller action. Make sure the specified $action exists in the plugin's controller. Otherwise behaves as {@link createWidget()}.
createWidget ( ) : ReportWidgetConfig Creates a widget based on the specified report in {@link construct()}.

Method Details

__construct() public method

Generates a new report widget factory.
public __construct ( Report $report )
$report piwik\plugin\Report A report instance, widgets will be created based on the data provided by this report.

createContainerWidget() public method

It will automatically use the report's categoryId, subcategoryId (if specified) and order in order to create the container.
public createContainerWidget ( string $containerId ) : WidgetContainerConfig
$containerId string eg 'Products' or 'Contents' see {Piwik\Widget\WidgetContainerConfig::setId()}. Other reports or widgets will be able to add more widgets to this container. This is useful when you want to show for example multiple related widgets together.
return Piwik\Widget\WidgetContainerConfig

createCustomWidget() public method

Creates a custom widget that doesn't use a viewDataTable to render the report but instead a custom controller action. Make sure the specified $action exists in the plugin's controller. Otherwise behaves as {@link createWidget()}.
public createCustomWidget ( string $action ) : ReportWidgetConfig
$action string eg 'conversionReports' (requires a method `public function conversionReports()` in the plugin's controller).
return ReportWidgetConfig

createWidget() public method

It will automatically use the report's name, categoryId, subcategoryId (if specified), defaultViewDataTable, module, action, order and parameters in order to create the widget.
public createWidget ( ) : ReportWidgetConfig
return ReportWidgetConfig