getValues(); if ($data['type'] == 'image') { $this->_setFile4Delete($data, 'backgroundImage'); $data['linkText'] = ''; } else { $this->_setFile4Delete($data, 'image'); } switch ($data['linkType']) { case 'url': $data['pageId'] = ''; break; case 'cms': $data['url'] = ''; break; default: $data['url'] = ''; $data['pageId'] = ''; $data['linkText'] = ''; break; } $this->_getDataObj()->initFromForm($data); return $this; } protected function _setFile4Delete(&$data, $name) { if ($data[$name]) { $session = new Qs_Session_Namespace(CURRENT_PAGE); if (!is_array($session->files)) { $session->files = []; } $session->files[$data[$name]] = $name; $data[$name] = null; } return $this; } }