function _webform_display_matrix in Webform Matrix Component 7.2
Same name and namespace in other branches
- 6 components/matrix.inc \_webform_display_matrix()
- 7.4 components/matrix.inc \_webform_display_matrix()
- 7 components/matrix.inc \_webform_display_matrix()
- 7.3 components/matrix.inc \_webform_display_matrix()
Implements _webform_display_component().
File
- components/
matrix.inc, line 530 - Webform module matrix component.
Code
function _webform_display_matrix($component, $value, $format = 'html') {
$headers = array();
$value_array = isset($value[0]) ? unserialize($value[0]) : '';
if (empty($value_array)) {
return array();
}
$sub_elements = $component['extra']['element'];
$display_array = _webform_display_array($sub_elements, $value_array, $headers);
$matrix_value = array(
'headers' => $headers,
'rows' => $display_array,
);
return array(
'#title' => $component['name'],
'#weight' => $component['weight'],
'#theme' => 'webform_display_matrix',
'#theme_wrappers' => $format == 'html' ? array(
'webform_element',
) : array(
'webform_element_text',
),
'#format' => $format,
'#value' => $matrix_value,
'#translatable' => array(
'title',
),
);
}