Commit c0e9f934 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Added support for passing arrays through as hidden values.

parent df4ec8c7
......@@ -29,8 +29,17 @@ defined('INTERNAL') || die();
/**
* Renders a hidden element
*/
function form_render_hidden($element, $form) {
function form_render_hidden($element, Form $form) {
unset($element['tabindex']);
$value = $form->get_value($element);
if (is_array($value)) {
$result = '';
foreach ($value as $k => $v) {
$result .= '<input type="hidden" name="' . hsc($element['name'])
. '[' . hsc($k) . ']" value="' . hsc($v) . "\">\n";
}
return $result;
}
return '<input type="hidden"'
. Form::element_attributes($element)
. ' value="' . hsc($form->get_value($element)) . '">';
......
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