'#title' => t('I have read and agree to the') . "<b><a href='/terms' target='_blank'> terms of service</a></b>",

How do I add a span class to the whole title, so It would end up like so:

 <span class="myclass">I have read and agree to the <b><a href='/terms' target='_blank'>terms of service</a></b></span>

You can use the following code:

'#title' => '<span class="myclass">' . t('I have read and agree to the <b><a href="@terms" target="_blank">terms of service</a></b>', array('@terms' => url('terms'))) . '</span>',

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.