I have defined the custom validation rule:
['Email', 'checkUniqueExistence'],
public function checkUniqueExistence($attribute, $params)
{
$email = $this->$attribute;
$checkUniqueExistenceForEmail = Parents::find()->where([ 'Email' => $email])->One();
$resendActivationLink = Html::a('Resend Link','#');
if(count($checkUniqueExistenceForEmail) > 0){
if($checkUniqueExistenceForEmail->IsAccountActivated == Yii::$app->params['IsAccountActivatedTrue']){
$this->addError($attribute, 'Email address already exists');
}
else{
$this->addError($attribute, 'You haven\'t activated your account. Request '.$resendActivationLink);
}
}
}
But link does not generate. It is displayed as a string. I got the following output after submitting the form:
You haven't activated your account. Request <a href="#">Resend Link</a>
Is it possible to display link in addError() method?