I am developing a Drupal module. Part of it opens a pop-up window, displays some elements in it, and uses JavaScript to transfer input back to the main page.
As this is a small window, I don't want it to display the full theme borders from the site's theme.
In Drupal 6 I was able to achieve this with the following:
function MyPopupPageHandler() {
@content = "Content...";
//Add additional content to @content;
print theme("page", @content);
}
However, Drupal 7 expects the second parameter of the theme() function to be an array, and none of the examples I've seen show how I set the main content of the page.
What I'd like is a custom page template in the module, that can be overridden by the site theme if it provides one.
I would like to know:
- What elements do I need to put in the array I pass to the theme() function?
- What should I call my template file?
- How do I tell Drupal where to find my template, as it needs to be in the module by default?
Appreciate any help you can offer.
James
1) The second parameter of
theme()function must be an associative array. Your function should look like :2) I guess you meant "Where should I call my template file?" In the
hook_theme()function in your same.modulefile :3) To tell where to find your custom template file if you decide to use one, you can read this : https://drupal.org/node/715160 and I hope it will help.
Please stay indulgent because I'm still new with Drupal and I did try to do my best here :o)