How do we discreetly add help popups to other modules' pages, core or otherwise?
jccc - February 10, 2009 - 19:17
| Project: | Advanced help |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Say we want to add help pop-ups to a story-submit form, or to nodes of our custom content types, or to left-side menu items. But we wouldn't want to go hacking into modules that aren't ours and create maintenance headaches. Just looking for advice from anyone who can give insight--thanks.

#1
Please correct me if I'm mistaken, but it looks like the only thing stopping me from doing this is the presence of help-icon.css. If I hammer this style right into the page template, I can drop in the help icons wherever I want (i.e., via theme templates) and leave them pointing to the advanced_help module or presumably a wrapper module of my own for storing the help HTML files.
Maybe there's a more elegant way to do this. I'd prefer not to duplicate that style line on those pages where it already appears, but at least this would make it work.
#2
Really all you should need to do is add theme('help_topic') at the appropriate place and all .css should be taken care of for you. You can inject this during theming or during module hooks. You can easily write a custom module to store whatever help you like.
#3
Just to clarify:
I tried testing this by adding the theme() function to the footer in the page template. I could see my new help icon when I was on the advanced_help pages or on the view pages--in other words on pages generated by modules already making use of advanced_help.
But on other pages the icon wouldn't show up correctly (instead showing only the un-styled "Help" text) unless I hacked the help-icon.css directly into the HTML head. The idea here is to be able to add help icons to places across the site, not just those made to use advanced_help.
I suppose I can deal with an errant or occasionally duplicate CSS, unless I'm missing some other possibility.
#4
Oh! Once you're inside page.tpl.php the css and scripts are already processed, which is possibly the problem. Meaning that even though theme('advanced_help_topic') is trying to add the css/js to the page, the css/js for the page are already rendered and you can't add any more.
You may have to manually add those to your template if you know you're going to use them later, or do something early enough to drupal_add_css/drupal_add_js them.
#5
You can use the HelpInject module. It allows you to inject help icons into pages and form elements without hacking the core or modules. It uses Drupal's hooks and APIs to do this. You can also use it to author your help texts using Drupal's book structures.
http://drupal.org/project/helpinject
#6
Marking as fixed.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.