X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=blobdiff_plain;f=lib%2Fformslib.php;h=0e48c40b2c693bc818e032fb1bab5f702bd1553a;hp=0b62cef7edb2430d63e34a2b558952f4fbcabf5a;hb=53a78cef28cbd73679dbfc48f68b52726a125f80;hpb=3a915b066765efc3cc166ae8186405f67c04ec2c diff --git a/lib/formslib.php b/lib/formslib.php index 0b62cef7edb..0e48c40b2c6 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -1358,6 +1358,25 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless { } } + /** + * Add a help button to element, + * only one button per element is allowed. + * + * @param string $elementname name of the element to add the item to + * @param string $identifier + * @param string $title + * @param string $component + * @param string $linktext + * @return void + */ + function addHelpButton($elementname, $identifier, $title, $component = 'moodle', $linktext = '') { + if (array_key_exists($elementname, $this->_elementIndex)) { + $element->_helpbutton = $OUTPUT->help_icon($identifier, $title, $component, $linktext); + } else if (!$suppresscheck) { + debugging(get_string('nonexistentformelements', 'form', $elementname)); + } + } + /** * Set constant value not overriden by _POST or _GET * note: this does not work for complex names with [] :-(