getAction() public méthode

Get the currently set action.
public getAction ( ) : string
Résultat string
Exemple #1
0
 /**
  * @param WidgetConfig $widget
  * @param CategoryList|null $categoryList If null, no category information will be added to the widgets in first
  *                                        level (they will be added to nested widgets as potentially needed eg for
  *                                        widgets in ByDimensionView where they are needed to build the left menu)
  * @return array
  */
 public function buildWidgetMetadata(WidgetConfig $widget, $categoryList = null)
 {
     $item = array('name' => Piwik::translate($widget->getName()));
     if (isset($categoryList)) {
         $category = $categoryList->getCategory($widget->getCategoryId());
         $subcategory = $category ? $category->getSubcategory($widget->getSubcategoryId()) : null;
         $item['category'] = $this->buildCategoryMetadata($category);
         $item['subcategory'] = $this->buildSubcategoryMetadata($subcategory);
     }
     $item['module'] = $widget->getModule();
     $item['action'] = $widget->getAction();
     $item['order'] = $widget->getOrder();
     $item['parameters'] = $widget->getParameters();
     $item['uniqueId'] = $widget->getUniqueId();
     $item['isWide'] = $widget->isWide();
     $middleware = $widget->getMiddlewareParameters();
     if (!empty($middleware)) {
         $item['middlewareParameters'] = $middleware;
     }
     if ($widget instanceof ReportWidgetConfig) {
         $item['viewDataTable'] = $widget->getViewDataTable();
         $item['isReport'] = true;
     }
     if ($widget instanceof WidgetContainerConfig) {
         $item['layout'] = $widget->getLayout();
         $item['isContainer'] = true;
         // we do not want to create categories to the inital categoryList. Otherwise we'd maybe display more pages
         // etc.
         $subCategoryList = new CategoryList();
         $this->createMissingCategoriesAndSubcategories($subCategoryList, $widget->getWidgetConfigs());
         $children = array();
         foreach ($widget->getWidgetConfigs() as $widgetConfig) {
             $children[] = $this->buildWidgetMetadata($widgetConfig, $subCategoryList);
         }
         $item['widgets'] = $children;
     }
     return $item;
 }
Exemple #2
0
 private function checkIsValidWidget(WidgetConfig $widget)
 {
     if (!$widget->getModule()) {
         Development::error('No module is defined for added widget having name "' . $widget->getName());
     }
     if (!$widget->getAction()) {
         Development::error('No action is defined for added widget having name "' . $widget->getName());
     }
 }