logo

Message Format in Drupal 8

30
August

Message Format in Drupal 8
By: Anonymous | Published On: Mon, 08/30/2021 - 12:29

Error Message Format

 

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\FormStateInterface;
drupal_set_message(t('Something wrong!'),'error');
$form_state->setErrorByName('error',$message);	

		if ($this->validEmailAddress($form_state->getValue('email_address'))) {
			$form_state->setErrorByName('email_address', t('User exist with given Email address.'));
		}


Need Help ?