Created
November 4, 2020 08:21
-
-
Save JayKandari/2b60111544071f0012c0ab6c516e7eb8 to your computer and use it in GitHub Desktop.
Drupal 8 - Create a Link inside Drupal message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
// Create a Url object. | |
$url = Url::fromRoute('node.add_page'); | |
// Create a Link object. | |
$link = Link::fromTextAndUrl(t('Add more content'), $url); | |
// Show the message with Link. | |
\Drupal::messenger()->addMessage(t('Configuration Saved. @add', [ | |
'@add' => $link->toString(), | |
])); | |
// Thanks 🙂 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment