You are here

function _webform_display_product in Ubercart Webform Integration 6

Same name and namespace in other branches
  1. 7.3 components/product.inc \_webform_display_product()
  2. 7.2 components/product.inc \_webform_display_product()

Display the result of a submission for a component.

File

components/product.inc, line 198
Webform module product component.

Code

function _webform_display_product($component, $value, $format = 'html') {
  $product_info = explode('_', $component['extra']['product'], 2);
  $node = node_load($product_info[0]);
  $result_info = array(
    t('Title: @title<br/>SKU: @sku<br/>Quantity: @quantity', array(
      '@title' => $node->title,
      '@sku' => $product_info[1],
      '@quantity' => $value[2],
    )),
  );
  $element = array(
    '#title' => check_plain($component['name']),
    '#weight' => $component['weight'],
    '#theme' => 'uc_webform_display_product',
    '#theme_wrappers' => $format == 'html' ? array(
      'webform_element',
    ) : array(
      'webform_element_text',
    ),
    '#post_render' => array(
      'webform_element_wrapper',
    ),
    '#component' => $component,
    '#format' => $format,
    '#value' => $result_info,
  );
  return $element;
}