id = $id; return $this; } /** * Get the id of the widget. * @return string */ public function getId() { return $this->id; } /** * Sets the layout of the container widget. * * By default widgets within a container are displayed one after another. In case you want to change this * behaviour you can specify a layout that will be recognized by the UI. It is not yet possible to define * custom layouts. * * @param string $layout eg 'ByDimension' see {@link Piwik\Plugins\CoreHome\CoreHome::WIDGET_CONTAINER_LAYOUT_BY_DIMENSION} * @return static */ public function setLayout($layout) { $this->layout = $layout; return $this; } /** * Gets the currently set layout. * @return string */ public function getLayout() { return $this->layout; } /** * Adds a new widget to the container widget. * * @param WidgetConfig $widget * @return static */ public function addWidgetConfig(WidgetConfig $widget) { $this->widgets[] = $widget; return $this; } /** * Set (overwrite) widget configs. * * @param WidgetConfig[] $configs */ public function setWidgetConfigs($configs) { $this->widgets = $configs; } /** * Get all added widget configs. * * @return WidgetConfig[] */ public function getWidgetConfigs() { return $this->widgets; } /** * @inheritdoc */ public function getUniqueId() { $parameters = $this->getParameters(); unset($parameters['module']); unset($parameters['action']); unset($parameters['containerId']); return WidgetsList::getWidgetUniqueId($this->id, '', $parameters); } /** * @inheritdoc */ public function getParameters() { $params = parent::getParameters(); $params['containerId'] = $this->getId(); return $params; } }