You are here

function commerce_invoice_update_8202 in Commerce Invoice 8.2

Add a file field to invoices that holds a reference to the PDF file.

File

./commerce_invoice.install, line 71
Contains install and update functions for Commerce Invoice.

Code

function commerce_invoice_update_8202() {
  $storage_definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Invoice PDF'))
    ->setSetting('target_type', 'file')
    ->setDescription(t('The invoice PDF file.'))
    ->setDisplayConfigurable('view', TRUE);
  $definition_manager = \Drupal::entityDefinitionUpdateManager();
  $definition_manager
    ->installFieldStorageDefinition('invoice_file', 'commerce_invoice', 'commerce_invoice', $storage_definition);
}