I've got a form with a #markup
element and I'm trying to use a php file as the contents of the markup. The following is printing a 1 where the markup should goes, and printing the contents of the file as the first elements in my page's body tag.
$path = drupal_get_path('theme', 'my_subtheme');
$template = "$path/templates/myfile.php";
$form['membership_info'] = array(
'#markup' => include $template,
'#weight' => 0,
);
I understand that the include line is probably including the file at the top of the page, and the markup is rendering as 1 because include $template
is returning true, I'm just not sure how to get my desired outcome. Any ideas as to how I can get it to render how I'm expecting it to?
I was using a custom template for the entire form but that was stopping it from submitting. As such I'm instead trying to work my way around it by using this markup element to contain all of the non-form-field logic at the top of my form.