getConfig('contactReasonEnabled'); $this->_getDataObj()->setHasReason($hasReason); if (null === $this->_idItem) { $this->_idItem = abs(crc32(__CLASS__)); } $this->_userFieldRules['name'] = [$this, 'prepareUserName']; return $this; } protected function prepareUserName(array $userData) { return $userData['firstName'] . ' ' . $userData['lastName']; } protected function _getMailData(array $data) { $viewUrl = Qs_SiteMap::findFirst(null, ['type' => 'Form_Contact_Admin_'], null, 'url'); $emptyValue = $this->getConfig('emptyFieldText'); $mailData = [ 'name' => htmlspecialchars($data['name']), 'email' => htmlspecialchars((empty($data['email']) ? $emptyValue : $data['email'])), 'phone' => htmlspecialchars((empty($data['phone']) ? $emptyValue : $data['phone'])), 'comments' => nl2br(htmlspecialchars($data['comments'])), 'link' => $viewUrl . '?action=view&id=' . $data['id'], ]; if ($this->getConfig('contactReasonEnabled', true)) { $reasons = $this->_getDataObj()->getDContactReason4Select(); $mailData['reason'] = Qs_Array::get($reasons, $data['idReason']); } return $mailData; } protected function _getNewForm(array $options = []) { if (null === $this->_form) { $options['hasReason'] = $this->_getDataObj()->hasReason(); $options['reasons'] = $this->_getDataObj()->getDContactReason4Select(); $this->_form = parent::_getNewForm($options); } return $this->_form; } }