public function load($data, $formName = NULL) { if (empty($data)) { return false; } if (!\Yii::$app->request->isAjax) { $scope = $formName === null ? $this->formName() : $formName; if (isset($data[$scope]["appLogo"])) { $postLogo = $data[$scope]["appLogo"]; if (pathinfo($postLogo["path"], PATHINFO_BASENAME) != pathinfo($this->appLogo, PATHINFO_BASENAME)) { $this->deleteOldLogo(); $attachment = $this->saveLogo($postLogo["path"]); $logo = $attachment->getUrl(); } else { $logo = $this->appLogo; } } else { if (!empty($this->appLogo)) { $this->deleteOldLogo(); } $logo = ""; } $data[$scope]["appLogo"] = $logo; } return parent::load($data); }
public function init() { parent::init(); $this->prefix = \hass\comment\Module::getInstance()->id . "."; }