Yellow Help Question Marks

Yellow Help Question Marks

by Anthony Mingus -
Number of replies: 4
How do I make my own to use?

I would like to be able to create my own using context sensitive help when I need to.

All I have seen is Moodle Help with the yellow question mark.
Average of ratings: -
In reply to Anthony Mingus

Re: Yellow Help Question Marks

by David Berry -
Interesting question and one that I have never considered before. I went immediately to the source code for this page to see how it was done on Moodle.org. It looks like the "help.gif" can be linked to anything - in this case it opens up a popup page.

Regards

David Berry
In reply to David Berry

Re: Yellow Help Question Marks

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There is a function helpbutton in weblib.php, which is the thing to sue, and also print_heading_with_help, which is useful shortcut sometimes.

For forms built with lib/formslib (as all forms should be these days) see http://docs.moodle.org/en/Development:lib/formslib.php_Form_Definition#setHelpButton.

Suppose you print a help button with the call

helpbutton('mypage', get_string('tooltip', 'mymod'), 'mymod');

Then this will make a help button with a tooltip "Help with ..." where the ... is replaced with the lang string 'tooltip' from the 'mymod' language file, and clicking on the button will open the 'mypage.html' help file. More exactly, Suppose your Moodle is set to use the French language pack, and the parent of the French Language pack, then Moodle will show the first of these files that exist:

/moodledata/lang/fr_utf8/help/mymod/mypage.html
/moodle/lang/fr_utf8/help/mymod/mypage.html
/mod/mymod/lang/fr_utf8/help/mymod/mypage.html
/moodledata/lang/en_utf8/help/mymod/mypage.html
/moodle/lang/en_utf8/help/mymod/mypage.html
/mod/mymod/lang/en_utf8/help/mymod/mypage.html

If you are working on another sort of plugin, instead of a module, then it is slightly different. For example

helpbutton('mypage', get_string('tooltip', 'block_myblock'), 'block_myblock');

searches

/moodledata/lang/fr_utf8/help/block_myblock/mypage.html
/moodle/lang/fr_utf8/help/block_myblock/mypage.html
/block/myblock/lang/fr_utf8/help/myblock/mypage.html
/moodledata/lang/en_utf8/help/block_myblock/mypage.html
/moodle/lang/en_utf8/help/block_myblock/mypage.html
/block/myblock/lang/en_utf8/help/myblock/mypage.html

I hope I got that right. If you really want to understand this, you just need to read the code of places_to_search_for_lang_strings() and get_string() from lib/moodlelib.php, and the top-level help.php.

It would probably be worth someone writing a really good developer-focussed page about all this on docs.moodle.org. There is some useful information there under http://docs.moodle.org/en/Category:Language, but no one of those pages will tell a developer everything they need to know, an no more.
In reply to Tim Hunt

Re: Yellow Help Question Marks

by Anthony Mingus -

WOW!!  Now this is what I was looking for.  Tim that was awesome.  Now I just have to get it to work for my specific situation.  Thanks.

Anthony

In reply to David Berry

Re: Yellow Help Question Marks

by Anthony Mingus -

Thanks David.  I was hoping that it would be.  That means whatever page I modify I will link the gif to my new information.

Anthony