You are here

function commerce_line_item_title in Commerce Core 7

Returns the title of a line item based on its type.

Titles are returned sanitized and so do not need to be sanitized again prior to display.

Parameters

$line_item: The line item object whose title should be returned.

Return value

The type-dependent title of the line item.

2 calls to commerce_line_item_title()
commerce_line_item_field_widget_form in modules/line_item/commerce_line_item.module
Implements hook_field_widget_form().
commerce_line_item_handler_field_line_item_title::render in modules/line_item/includes/views/handlers/commerce_line_item_handler_field_line_item_title.inc
Render the field.

File

modules/line_item/commerce_line_item.module, line 786
Defines the core Commerce line item entity and API functions interact with line items on orders.

Code

function commerce_line_item_title($line_item) {

  // Find the line item type's title callback.
  $line_item_type = commerce_line_item_type_load($line_item->type);
  $title_callback = commerce_line_item_type_callback($line_item_type, 'title');
  return $title_callback ? $title_callback($line_item) : '';
}