I have a TranslatableMarkup string that has a link that is inserted in it as a variable. However this link comes without a space between the link and the previous word in the string.

$message = new TranslatableMarkup("Some message and last word @link", ["@link" => $link]);

This message is then printed out using drupal_set_message. The message comes without the space between 'word' and the link when it is displayed.

This is the expected behaviour with browser ignoring the white space before the tag with the link. How do we force this without custom inline block styling for the link?

  • 1
    Ensure the text and link is wrapped in a <p> tag or other type tag. – Prestosaurus Mar 12 '20 at 23:47
  • Switch to bartik theme, is it still like that? – No Sssweat Mar 13 '20 at 1:18
  • Thanks @Prestosaurus that worked. – anoopjohn Apr 6 '20 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.