Skip to main content
We work with
PlumbersRestaurantsBoutiquesDentists Law OfficesGymsHair SalonsFood Trucks ContractorsAccountantsPet GroomersFlorists RealtorsChiropractorsAuto Shops PlumbersRestaurantsBoutiquesDentists Law OfficesGymsHair SalonsFood Trucks ContractorsAccountantsPet GroomersFlorists RealtorsChiropractorsAuto Shops

Set Message with a link as an argument

Need to output a message with a link in the text?

$link = Link::createFromRoute('Link Title', 'my_module.my_route', [
          'argument' => 'argument value',
        ]);
        
        $m_args = ['%message_link' => $link->toString()];
        
        \Drupal::messenger()->addStatus(t('Here is a message, and here is a link. %message_link', $m_args));