function i18n_commerce_product_line_item_title in Internationalization for commerce product 7
Return translated title of line item.
1 call to i18n_commerce_product_line_item_title()
- i18n_commerce_product_line_item_handler_field_line_item_title::render in includes/
views/ handlers/ i18n_commerce_product_line_item_handler_field_line_item_title.inc - Render the field.
File
- ./
i18n_commerce_product.module, line 297
Code
function i18n_commerce_product_line_item_title($line_item) {
global $language;
$wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
if (!empty($line_item->commerce_product)) {
$product = $wrapper->commerce_product
->value();
$title = $product->title;
if ($language->language != $product->language) {
if (!empty($product->tproduct_id)) {
$translations = i18n_commerce_product_product_get_translations($product->tproduct_id, TRUE);
}
else {
// We have no translation source nid, this could be a new set, emulate that.
$translations = i18n_commerce_product_product_get_translations($product->product_id);
}
if (!empty($translations[$language->language])) {
$title = $translations[$language->language]->title;
}
}
return $title;
}
}