/var/www/vhosts/ihelp.ro/httpdocs/src/Form
Edit: /var/www/vhosts/ihelp.ro/httpdocs/src/Form/ShareForm.php (1571B)
addField('email', ['type' => 'string']);
return $schema;
}
/**
* Form validation builder
*/
public function validationDefault(Validator $validator): Validator
{
$validator
->email('email', true, __('Valoarea furnizată este invalidă'))
->maxLength('email', 255)
->requirePresence('email', 'create')
->notEmptyString('email', __('Acest câmp nu poate fi lăsat gol'));
return $validator;
}
/**
* Defines what to execute once the Form is processed
*/
protected function _execute(array $data): bool
{
$return = false;
try {
$this->getMailer('Form')->send('share', [$data]);
$return = true;
} catch (\Throwable $th) {
//throw $th;
$errors['email'] = __('Email-ul nu a putut fi trimis. Error #6464686845');
$this->setErrors($errors);
}
return $return;
}
/**
* setErrors
*/
public function setErrors($errors)
{
foreach ($errors as $key => $error) {
$this->_errors[$key] = $error;
}
}
}