You are here

function webform_rules_render_component in Webform Rules 6

Same name and namespace in other branches
  1. 7 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_token_values in ./webform_rules.module
Implementation of hook_token_values().

File

./webform_rules.module, line 287
Adds rules integration for webform submissions.

Code

function webform_rules_render_component($component, $value, $format = 'text', $title = TRUE) {
  module_load_include('inc', 'webform', 'includes/webform.components');
  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'] = form_clean_id('edit-' . implode('-', $display_element['#parents']));
  }
  if (!$title) {
    $display_element['#title'] = NULL;
  }
  return drupal_render($display_element);
}