I'm using Drupal's Forms API in my module, and I'm attempting to output a link as part of some markup:
//$output = l('Result', 'document/1234');
$output = '<a href="document/1234">Result</a>';
$form['results'] = array(
'#type' => 'markup',
'#markup' => $output,
)
I've tried use both a simple string and the l() function and in both cases when the page is rendered, the link does not work, and when I inspect the element, it is mangled like this:
<a href=" 1234"="" document="">
and the closing tag is missing.
So far as I can see I'm not doing any post-processing of any kind on the markup before it is rendered.
In other places in my module I have created links like this and they are output normally.
Any ideas?
That's very strange, it sounds like another module must be changing it...do you have translation/string replacement modules installed by any chance?
This should help you get it around it in the mean time, you can use render arrays and
theme_link
to output a link like this:Note that
html
inattributes
is a required key.