You are here

function commerce_license_entity_info in Commerce License 7

Implements hook_entity_info().

File

./commerce_license.module, line 132
Provides a framework for selling access to local or remote resources.

Code

function commerce_license_entity_info() {
  $return = array(
    'commerce_license' => array(
      'label' => t('Commerce License'),
      'label callback' => 'commerce_license_label',
      'controller class' => 'CommerceLicenseEntityController',
      'base table' => 'commerce_license',
      'revision table' => 'commerce_license_revision',
      'module' => 'commerce_license',
      'bundle plugin' => array(
        'plugin type' => 'license_type',
        // The name of the class to use when loading an invalid bundle.
        'broken class' => 'CommerceLicenseBroken',
      ),
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'license_id',
        'bundle' => 'type',
        'revision' => 'revision_id',
      ),
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
          'custom settings' => TRUE,
        ),
        'line_item' => array(
          'label' => t('Line item summary'),
          'custom settings' => TRUE,
        ),
      ),
      'metadata controller class' => 'CommerceLicenseMetadataController',
      'views controller class' => 'CommerceLicenseViewsController',
      'access callback' => 'commerce_license_access',
      'access arguments' => array(
        'user key' => 'uid',
      ),
      'inline entity form' => array(
        'controller' => 'CommerceLicenseInlineEntityFormController',
      ),
    ),
  );
  foreach (commerce_license_get_type_plugins() as $plugin_name => $plugin) {
    $return['commerce_license']['bundles'][$plugin_name] = array(
      'label' => $plugin['title'],
    );
  }
  return $return;
}