I am writing a module that will want to display a custom page with some content that varies based on the results of the action the module took. Basically I want to be able to insert my 4-5 variables into specific places in a pre-existing layout. But I don't want to hard-code it in the module. If this was just modifying the display of an existing node I could do it, but I am not sure how to attach a custom template to my output.
At the moment(testing) I am just outputting the variables in a list which gets embedded in the body of a page with all the standard surrounding items (sidebars, header/footer regions and blocks). This is great as far as it goes, I just need more control over that $content area.
At the moment this is how I am doing what I mentioned:
$list[] = t('The source was @number.', array('@number' => $source));
$list[] = t('The work type value was @number.', array('@number' => $wrktype));
$render_array['example_return_arguments'] = array(
'#theme' => 'item_list', // The theme function to apply to the #items
'#items' => $list, // The list itself.
'#title' => t('Return Status Information'),
);
return $render_array;
}
Is there a way to expand/modify this to call a user defined theme with my variable list? I thought I had seen something that did that once but I can't find it again :-(
Any pointers or help appreciated. And just to state what may be obvious based on the group, this is for Drupal 7.
Thanks
Comments
make your own theme function and register it
From IRC #drupal-themes
and since I am doing this under Drupal7 I'll be checking out http://drupal.org/node/933976
Still not Groking
I've been reading the link above and doing some experimenting, but still don't seem to have the pieces in place. I'm probably missing one of the interlocking pieces. I usually like to take apart a working example and experiment and see how things interact, but unfortunately I can't find one. The examples project doesn't have anything official and the early attempt I found in reply #20 to issue #951340: Theming for module developers example does run and have templates in the tarball, but from what I can tell, it doesn't actually use them.
Still digging.