function _webform_display_productfield in Commerce Webform 7
Same name and namespace in other branches
- 8 productfield.inc \_webform_display_productfield()
- 7.2 productfield.inc \_webform_display_productfield()
Implements _webform_display_component().
File
- ./
productfield.inc, line 369
Code
function _webform_display_productfield($component, $value, $format = 'html') {
$options = array();
foreach ($component['extra']['items'] as $product_id => $details) {
$options[$product_id] = "{$details['sku']}: {$details['title']} ";
}
return array(
'#title' => $component['name'],
'#weight' => $component['weight'],
'#theme' => 'webform_display_productfield',
'#theme_wrappers' => $format == 'html' ? array(
'webform_element',
) : array(
'webform_element_text',
),
'#format' => $format,
'#options' => $options,
'#value' => (array) $value,
'#translatable' => array(
'title',
'options',
),
);
}