By admin, 6 December, 2017
$token = \Drupal::token();
$message_html = "hello [current-page:title] ----- [amount-node:amount:2]";
  // Replace the token for subject.
  $email_auth = $token->replace($message_html, array('amount-node' => $amount));

 

ถ้า Token มี html มันจะไม่ render html  เราต้องใช้ function " htmlspecialchars_decode "
ตัวอย่าง :

htmlspecialchars_decode($email_auth);