addWidgetConfig() 공개 메소드

Adds a new widget to the container widget.
public addWidgetConfig ( WidgetConfig $widget ) : static
$widget WidgetConfig
리턴 static
예제 #1
0
파일: WidgetsList.php 프로젝트: piwik/piwik
 private function addContainer(WidgetContainerConfig $containerWidget)
 {
     $widgetId = $containerWidget->getId();
     $this->container[$widgetId] = $containerWidget;
     // widgets were added to this container, but the container did not exist yet.
     if (isset($this->containerWidgets[$widgetId])) {
         foreach ($this->containerWidgets[$widgetId] as $widget) {
             $containerWidget->addWidgetConfig($widget);
         }
         unset($this->containerWidgets[$widgetId]);
     }
 }
예제 #2
0
파일: Pages.php 프로젝트: piwik/piwik
 private function buildGoalByDimensionView($idGoal, WidgetContainerConfig $container)
 {
     $container->setLayout('ByDimension');
     $ecommerce = $idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER;
     // for non-Goals reports, we show the goals table
     $customParams = array('documentationForGoalsPage' => '1');
     if ($idGoal === '') {
         // if no idGoal, use 0 for overview. Must be string! Otherwise Piwik_View_HtmlTable_Goals fails.
         $customParams['idGoal'] = '0';
     } else {
         $customParams['idGoal'] = $idGoal;
     }
     $translationHelper = new TranslationHelper();
     foreach ($this->allReports as $category => $reports) {
         $order = $this->getSortOrderOfCategory($category) * 100;
         if ($ecommerce) {
             $categoryText = $translationHelper->translateEcommerceMetricCategory($category);
         } else {
             $categoryText = $translationHelper->translateGoalMetricCategory($category);
         }
         foreach ($reports as $report) {
             $order++;
             if (empty($report['viewDataTable']) && empty($report['abandonedCarts'])) {
                 $report['viewDataTable'] = 'tableGoals';
             }
             if (!empty($report['parameters'])) {
                 $params = array_merge($customParams, $report['parameters']);
             } else {
                 $params = $customParams;
             }
             $widget = $this->createWidgetForReport($report['module'], $report['action']);
             if (!empty($report['name'])) {
                 $widget->setName($report['name']);
             }
             $widget->setParameters($params);
             $widget->setCategoryId($categoryText);
             $widget->setSubcategoryId($categoryText);
             $widget->setOrder($order);
             $widget->setIsNotWidgetizable();
             if (!empty($report['viewDataTable'])) {
                 $widget->forceViewDataTable($report['viewDataTable']);
             }
             $container->addWidgetConfig($widget);
         }
     }
 }