MDL-14943 "moodle_url : need way to add extra params when outputting params as hidden fields for forms" added new optional param to method hidden_params_out

This commit is contained in:
jamiesensei
2008-05-22 13:29:19 +00:00
parent 66fa80f960
commit f44e4d1404
+5 -2
View File
@@ -392,12 +392,15 @@ class moodle_url {
*
* @param array $exclude params to ignore
* @param integer $indent indentation
* @param array $overrideparams params to add to the output params, these
* override existing ones with the same name.
* @return string html for form elements.
*/
function hidden_params_out($exclude = array(), $indent = 0){
function hidden_params_out($exclude = array(), $indent = 0, $overrideparams=array()){
$tabindent = str_repeat("\t", $indent);
$str = '';
foreach ($this->params as $key => $val){
$params = $overrideparams + $this->params;
foreach ($params as $key => $val){
if (FALSE === array_search($key, $exclude)) {
$val = s($val);
$str.= "$tabindent<input type=\"hidden\" name=\"$key\" value=\"$val\" />\n";