setDefaultViewDataTable() public method

Sets a default viewDataTable that should be used to render the report. This is not neccessarily the view that will be actually used to render the report. Eg if a user switched manually to another viewDataTable Piwik will re-use the viewDataTable that was used the last time. If you want to force the usage of a viewDataTable use {@link forceViewDataTable()}.
public setDefaultViewDataTable ( string $viewDataTableId ) : static
$viewDataTableId string eg 'table' or 'graph'
return static
Example #1
0
 /**
  * Creates a widget based on the specified report in {@link construct()}.
  *
  * It will automatically use the report's name, categoryId, subcategoryId (if specified),
  * defaultViewDataTable, module, action, order and parameters in order to create the widget.
  *
  * @return ReportWidgetConfig
  */
 public function createWidget()
 {
     $widget = new ReportWidgetConfig();
     $widget->setName($this->report->getName());
     $widget->setCategoryId($this->report->getCategoryId());
     if ($this->report->getDefaultTypeViewDataTable()) {
         $widget->setDefaultViewDataTable($this->report->getDefaultTypeViewDataTable());
     }
     if ($this->report->getSubcategoryId()) {
         $widget->setSubcategoryId($this->report->getSubcategoryId());
     }
     $widget->setModule($this->report->getModule());
     $widget->setAction($this->report->getAction());
     $orderThatListsReportsAtTheEndOfEachCategory = 100 + $this->report->getOrder();
     $widget->setOrder($orderThatListsReportsAtTheEndOfEachCategory);
     $parameters = $this->report->getParameters();
     if (!empty($parameters)) {
         $widget->setParameters($parameters);
     }
     return $widget;
 }