You are here

function commerce_file_entity_info in Commerce File 7

Implements hook_entity_info().

File

./commerce_file.module, line 35
Provides integration of file licenses with Commerce

Code

function commerce_file_entity_info() {
  $module_path = drupal_get_path('module', 'commerce_file');
  $return = array(
    COMMERCE_FILE_LICENSE_ENTITY_NAME => array(
      'module' => 'commerce_file',
      'label' => _commerce_file_translatables('license_label'),
      'base table' => COMMERCE_FILE_LICENSE_ENTITY_NAME,
      'controller class' => 'CommerceFileLicenseEntityController',
      'entity class' => 'CommerceFileLicenseEntity',
      'rules controller class' => 'CommerceFileLicenseEntityRulesController',
      // FALSE to kill
      'views controller class' => FALSE,
      // FALSE to kill
      'fieldable' => TRUE,
      'exportable' => FALSE,
      'entity keys' => array(
        'id' => 'license_id',
        'bundle' => 'type',
      ),
      'bundle keys' => array(
        'bundle' => 'type',
      ),
      'bundles' => array(
        COMMERCE_FILE_LICENSE_ENTITY_NAME => array(
          'label' => _commerce_file_translatables('license_label'),
          'admin' => array(
            'path' => 'admin/commerce/config/file-licenses',
            'real path' => 'admin/commerce/config/file-licenses',
            'access arguments' => array(
              'administer ' . COMMERCE_FILE_LICENSE_ENTITY_NAME,
            ),
          ),
        ),
      ),
      'load hook' => 'commerce_file_license_load',
      'uri callback' => 'entity_class_uri',
      'label callback' => 'entity_class_label',
      'access callback' => 'commerce_file_license_access',
      'view modes' => array(
        'admin' => array(
          'label' => t('Administrator'),
          'custom settings' => FALSE,
        ),
        'customer' => array(
          'label' => t('Customer'),
          'custom settings' => FALSE,
        ),
      ),
      'admin ui' => array(
        'path' => 'admin/commerce/file-licenses',
        'file' => 'commerce_file_license.forms.inc',
        'file path' => $module_path . '/includes',
        'controller class' => 'CommerceFileLicenseEntityUIController',
      ),
    ),
  );

  // License log entity
  $return[COMMERCE_FILE_LICENSE_LOG_ENTITY_NAME] = array(
    'module' => 'commerce_file',
    'label' => _commerce_file_translatables('log_label'),
    'entity class' => 'CommerceFileLicenseLogEntity',
    'controller class' => 'CommerceFileLicenseLogEntityController',
    'base table' => COMMERCE_FILE_LICENSE_LOG_ENTITY_NAME,
    'fieldable' => FALSE,
    'exportable' => FALSE,
    'entity keys' => array(
      'id' => 'aid',
    ),
  );
  return $return;
}