You are here

function commerce_line_item_type_callback in Commerce Core 7

Returns the specified callback for the given line item type if one exists.

Parameters

$line_item_type: The line item type array.

$callback: The callback function to return, one of:

  • configuration
  • title
  • add_form
  • add_form_validate
  • add_form_submit

Return value

string A string containing the name of the callback function or FALSE if it could not be found.

4 calls to commerce_line_item_type_callback()
commerce_line_item_configure_line_item_type in modules/line_item/commerce_line_item.module
Configures a line item type by adding default price fields and then calling its configuration callback.
commerce_line_item_field_widget_form in modules/line_item/commerce_line_item.module
Implements hook_field_widget_form().
commerce_line_item_manager_validate in modules/line_item/commerce_line_item.module
Validation callback for a commerce_line_item_manager element.
commerce_line_item_title in modules/line_item/commerce_line_item.module
Returns the title of a line item based on its type.

File

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

Code

function commerce_line_item_type_callback($line_item_type, $callback) {

  // If the specified callback function exists, return it.
  if (!empty($line_item_type['callbacks'][$callback]) && is_callable($line_item_type['callbacks'][$callback])) {
    return $line_item_type['callbacks'][$callback];
  }

  // Otherwise return FALSE.
  return FALSE;
}