Commit e9de47fd by Scott

Allow hidden form fields to have extra attributes

parent fc634ce0
......@@ -280,8 +280,14 @@
),
'hidden' => array(
'dosaveprofile' => '1',
'code' => qa_get_form_security_code('account'),
'dosaveprofile' => array(
'tags' => 'name="dosaveprofile"',
'value' => '1',
),
'code' => array(
'tags' => 'name="code"',
'value' => qa_get_form_security_code('account'),
),
),
);
......@@ -421,8 +427,14 @@
),
'hidden' => array(
'dochangepassword' => '1',
'code' => qa_get_form_security_code('password'),
'dochangepassword' => array(
'tags' => 'name="dochangepassword"',
'value' => '1',
),
'code' => array(
'tags' => 'name="code"',
'value' => qa_get_form_security_code('password'),
),
),
);
......
......@@ -1197,9 +1197,18 @@ class qa_html_theme_base
public function form_hidden_elements($hidden)
{
if (!empty($hidden)) {
foreach ($hidden as $name => $value)
$this->output('<input type="hidden" name="'.$name.'" value="'.$value.'"/>');
if (empty($hidden))
return;
foreach ($hidden as $name => $value) {
if (is_array($value)) {
// new method of outputting tags
$this->output('<input '.@$value['tags'].' type="hidden" value="'.@$value['value'].'"/>');
}
else {
// old method
$this->output('<input name="'.$name.'" type="hidden" value="'.$value.'"/>');
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment