/** * Initialize widget (set attributes) * * @param array $params Widget params * * @return void */ public function setWidgetParams(array $params) { parent::setWidgetParams($params); if ($this->getCategoryId()) { if ($this->getCategoryId() == $this->getRootCategoryId()) { $this->widgetParams[static::PARAM_CATEGORY_ID]->setValue(0); } else { $this->widgetParams[static::PARAM_CATEGORY_ID]->setValue($this->getCategoryId()); } } }