You are here

function commerce_line_item_entity_info in Commerce Core 7

Implements hook_entity_info().

File

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

Code

function commerce_line_item_entity_info() {
  $return = array(
    'commerce_line_item' => array(
      'label' => t('Commerce Line item'),
      'controller class' => 'CommerceLineItemEntityController',
      'base table' => 'commerce_line_item',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'line_item_id',
        'bundle' => 'type',
        'label' => 'line_item_id',
      ),
      'bundle keys' => array(
        'bundle' => 'type',
      ),
      'bundles' => array(),
      'load hook' => 'commerce_line_item_load',
      'view modes' => array(
        'display' => array(
          'label' => t('Display'),
          'custom settings' => FALSE,
        ),
      ),
      'access callback' => 'commerce_line_item_access',
      'access arguments' => array(
        'access tag' => 'commerce_line_item_access',
      ),
      'metadata controller class' => '',
      'token type' => 'commerce-line-item',
      'permission labels' => array(
        'singular' => t('line item'),
        'plural' => t('line items'),
      ),
      // Prevent Redirect alteration of the line item form.
      'redirect' => FALSE,
    ),
  );
  $return['commerce_line_item']['bundles'] = array();
  foreach (commerce_line_item_type_get_name() as $type => $name) {
    $return['commerce_line_item']['bundles'][$type] = array(
      'label' => $name,
    );
  }
  return $return;
}