You are here

function commerce_gc_product_commerce_line_item_type_info_alter in Commerce GC 7

File

modules/commerce_gc_product/commerce_gc_product.module, line 38
Provides Giftcard product type and support.

Code

function commerce_gc_product_commerce_line_item_type_info_alter(&$info) {
  foreach ($info as $type => $line_item_info) {

    // Standard settings for all giftcard types.
    if (!empty($line_item_info['giftcard'])) {
      $info[$type]['product'] = TRUE;
      $callbacks = array(
        'configuration' => 'commerce_gc_product_line_item_configuration',
        'add_form' => 'commerce_gc_product_line_item_add_form',
        'add_form_submit' => 'commerce_gc_product_line_item_add_form_submit',
        'title' => 'commerce_product_line_item_title',
      );

      // Merge user settings into defaults
      if (isset($line_item_info['callbacks'])) {
        $info[$type]['callbacks'] = array_merge($line_item_info['callbacks'], $callbacks);
      }
      else {
        $info[$type]['callbacks'] = $callbacks;
      }
    }
  }
}