You are here

function commerce_invoice_entity_info in Commerce Invoice 7.2

Same name and namespace in other branches
  1. 7 commerce_invoice.module \commerce_invoice_entity_info()

Implements hook_entity_info().

File

./commerce_invoice.module, line 17
The Commerce Invoice module.

Code

function commerce_invoice_entity_info() {
  $entities = [];
  $entities['commerce_invoice'] = [
    'label' => t('Invoice'),
    'base table' => 'commerce_invoice',
    'revision table' => 'commerce_invoice_revision',
    'fieldable' => TRUE,
    'entity keys' => [
      'id' => 'invoice_id',
      'bundle' => 'type',
      'revision' => 'revision_id',
    ],
    'bundles' => [
      'commerce_invoice' => [
        'label' => t('Invoice'),
        'admin' => [
          'path' => 'admin/commerce/config/invoice',
          'access arguments' => [
            'administer commerce_invoice entities',
          ],
        ],
      ],
    ],
    'entity class' => Invoice::class,
    'controller class' => InvoiceController::class,
    'metadata controller class' => InvoiceMetadataController::class,
    'views controller class' => 'EntityDefaultViewsController',
    'access callback' => 'commerce_entity_access',
    'access arguments' => [
      'user key' => 'uid',
      'access tag' => 'commerce_invoice_access',
    ],
    'permission labels' => [
      'singular' => t('invoice'),
      'plural' => t('invoices'),
    ],
    'label callback' => 'entity_class_label',
    'uri callback' => 'entity_class_uri',
    'module' => 'commerce_invoice',
    'admin ui' => [
      'controller class' => 'EntityContentUIController',
      'path' => 'admin/commerce/invoices',
      'file' => 'commerce_invoice.admin.inc',
    ],
  ];
  $entities['commerce_invoice_number_pattern'] = [
    'label' => t('Invoice number pattern'),
    'base table' => 'commerce_invoice_number_pattern',
    'controller class' => 'EntityAPIControllerExportable',
    'entity class' => InvoiceNumberPattern::class,
    'entity keys' => [
      'id' => 'name',
      'name' => 'name',
      'label' => 'label',
      'status' => 'status',
    ],
    'exportable' => TRUE,
    'fieldable' => FALSE,
    'module' => 'commerce_invoice',
    'access callback' => 'commerce_invoice_number_pattern_access',
    'views controller class' => 'EntityDefaultViewsController',
    'admin ui' => [
      'path' => 'admin/commerce/config/invoice/numbers',
      'file' => 'commerce_invoice.admin.inc',
    ],
  ];
  return $entities;
}