function _webform_table_productfield in Commerce Webform 7.2
Same name and namespace in other branches
- 8 productfield.inc \_webform_table_productfield()
- 7 productfield.inc \_webform_table_productfield()
Implements _webform_table_component().
File
- ./
productfield.inc, line 623
Code
function _webform_table_productfield($component, $value) {
// Convert submitted 'safe' values to un-edited, original form.
$products = _productfield_products($component);
$value = (array) $value;
$items = array();
// Set the value as a single string.
foreach ($value as $option_value) {
$option_value = json_decode($option_value);
if (!empty($option_value->product_id)) {
if (isset($products[$option_value->product_id])) {
$item = $option_value->quantity . ' x ' . _webform_filter_xss($products[$option_value->product_id]->title);
}
else {
$item = check_plain($option_value->product_id);
}
$paid_display_option = empty($option_value->paid) ? t('Unpaid') : t('Paid');
$paid_display_option = empty($option_value->order_id) ? $paid_display_option : l($paid_display_option, "admin/commerce/orders/{$option_value->order_id}/view");
$item .= " (<strong>{$paid_display_option}</strong>)";
$items[] = $item;
}
}
return implode('<br />', $items);
}