function _webform_render_grid in Webform 6.3
Same name and namespace in other branches
- 5.2 components/grid.inc \_webform_render_grid()
- 5 components/grid.inc \_webform_render_grid()
- 6.2 components/grid.inc \_webform_render_grid()
- 7.4 components/grid.inc \_webform_render_grid()
- 7.3 components/grid.inc \_webform_render_grid()
Implements _webform_render_component().
File
- components/
grid.inc, line 146 - Webform module grid component.
Code
function _webform_render_grid($component, $value = NULL, $filter = TRUE) {
$node = isset($component['nid']) ? node_load($component['nid']) : NULL;
$element = array(
'#type' => 'webform_grid',
'#title' => $filter ? _webform_filter_xss($component['name']) : $component['name'],
'#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
'#required' => $component['mandatory'],
'#weight' => $component['weight'],
'#description' => $filter ? _webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'],
'#grid_questions' => _webform_select_options_from_text($component['extra']['questions'], TRUE),
'#grid_options' => _webform_select_options_from_text($component['extra']['options'], TRUE),
'#optrand' => $component['extra']['optrand'],
'#qrand' => $component['extra']['qrand'],
'#theme' => 'webform_grid',
'#theme_wrappers' => array(
'webform_element_wrapper',
),
'#process' => array(
'webform_expand_grid',
),
'#pre_render' => array(
'webform_element_title_display',
),
'#post_render' => array(
'webform_element_wrapper',
),
'#translatable' => array(
'title',
'description',
'grid_options',
'grid_questions',
),
);
if ($value) {
$element['#default_value'] = $value;
}
return $element;
}