function webform_rules_render_component in Webform Rules 7
Same name and namespace in other branches
- 6 webform_rules.module \webform_rules_render_component()
Render value of component.
Parameters
$component: Webform component to render.
$value: Submitted value of webform component.
$format: How to render the components value ('html' or 'text'). Defaults to 'text'.
$title: Renders the component title if set to TRUE.
Return value
The rendered component value.
1 call to webform_rules_render_component()
- webform_rules_tokens in ./
webform_rules.module - Implements hook_tokens().
File
- ./
webform_rules.module, line 352 - Adds rules integration for webform submissions.
Code
function webform_rules_render_component($component, $value, $format = 'text', $title = TRUE) {
if ($format != 'text') {
$format = 'html';
}
$display_element = webform_component_invoke($component['type'], 'display', $component, $value, $format);
$display_element['#parents'] = array(
'submitted',
$component['form_key'],
);
if (!isset($display_element['#id'])) {
$display_element['#id'] = drupal_clean_css_identifier('edit-' . implode('-', $display_element['#parents']));
}
if (!$title) {
$display_element['#title'] = NULL;
}
if (!isset($display_element['#webform_component'])) {
$display_element['#webform_component'] = $component;
}
return drupal_render($display_element);
}