Markup being stripped from form element title I need to add links to checkbox titles, I can see the link in the render array but when it renders the markup is stripped. How can I get the links to not be stripped?

I am doing this in a form alter, the checkboxes are added to the user registration form in the Drupal UI, i.e. they are form fields.

$tc_link = Link::fromTextAndUrl(new TranslatableMarkup('terms and conditions'), Url::fromRoute('&lt;front&gt;'))-&gt;toString();
$tc_link_label = t('You agree to the ') . $tc_link;
$form['field_terms_and_conditions']['#title'] = $tc_link_label;


The markup is like this:

&lt;div class="form-checkboxes" id="edit-field-terms-and-conditions"&gt;&lt;div class="js-form-item form-item js-form-type-checkbox form-type-checkbox js-form-item-field-terms-and-conditions-agree-terms-conditions form-item-field-terms-and-conditions-agree-terms-conditions"&gt;
        &lt;input name="field_terms_and_conditions[agree_terms_conditions]" class="form-checkbox" id="edit-field-terms-and-conditions-agree-terms-conditions" type="checkbox" value="agree_terms_conditions" data-drupal-selector="edit-field-terms-and-conditions-agree-terms-conditions"&gt;

        &lt;label class="option" for="edit-field-terms-and-conditions-agree-terms-conditions"&gt;You agree to the terms and conditions&lt;/label&gt;
      &lt;/div&gt;
&lt;/div&gt;


But if I inspect it with kint the links are clearly there.
In Drupal, strings need to be passed through the t() function for translation. This function uses string replacement to sanitize text. When passing links, the HTML should be put in the string, and the URL passed as a variable prefixed with a colon:

$tc_link_label = t('You agree to the &lt;a href=":url"&gt;terms and conditions&lt;/a&gt;', [':url' =&gt; Url::fromRoute('&lt;front&gt;')-&gt;toString()]);
$form['field_terms_and_conditions']['#title'] = $tc_link_label;