From: Dongsheng Cai Date: Fri, 18 Dec 2009 07:09:59 +0000 (+0000) Subject: "MDL-21153, fixed helpbutton debug message when using select & group elements" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=02e7a15db95f05559228e98cf4b3b085ddd0db12;p=moodle.git "MDL-21153, fixed helpbutton debug message when using select & group elements" --- diff --git a/lib/form/group.php b/lib/form/group.php index 1f91e48b94..74a49e5ca6 100644 --- a/lib/form/group.php +++ b/lib/form/group.php @@ -30,6 +30,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{ * @param string $function function name to call to get html */ function setHelpButton($helpbuttonargs, $function='helpbutton'){ + global $OUTPUT; if (!is_array($helpbuttonargs)){ $helpbuttonargs=array($helpbuttonargs); }else{ @@ -37,11 +38,13 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{ } //we do this to to return html instead of printing it //without having to specify it in every call to make a button. - if ('helpbutton' == $function){ + if ($function == 'helpbutton') { $defaultargs=array('', '', 'moodle', true, false, '', true); $helpbuttonargs=$helpbuttonargs + $defaultargs ; + $this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs)); + } else { + $this->_helpbutton=call_user_func_array($function, $helpbuttonargs); } - $this->_helpbutton=call_user_func_array($function, $helpbuttonargs); } /** * set html for help button diff --git a/lib/form/select.php b/lib/form/select.php index 83c1787141..92443e2a90 100644 --- a/lib/form/select.php +++ b/lib/form/select.php @@ -57,6 +57,7 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{ * @param string $function function name to call to get html */ function setHelpButton($helpbuttonargs, $function='helpbutton'){ + global $OUTPUT; if (!is_array($helpbuttonargs)){ $helpbuttonargs=array($helpbuttonargs); }else{ @@ -67,8 +68,10 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{ if ('helpbutton' == $function){ $defaultargs=array('', '', 'moodle', true, false, '', true); $helpbuttonargs=$helpbuttonargs + $defaultargs ; + $this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs)); + } else { + $this->_helpbutton=call_user_func_array($function, $helpbuttonargs); } - $this->_helpbutton=call_user_func_array($function, $helpbuttonargs); } /** * get html for help button