You are here

function commerce_invoice_field_extra_fields in Commerce Invoice 7

Implements hook_field_extra_fields().

File

./commerce_invoice.module, line 261
Generates the invoice and allows you to display an invoice id in views

Code

function commerce_invoice_field_extra_fields() {
  $extra = array();
  $extra['commerce_invoice']['commerce_invoice'] = array(
    'display' => array(
      'invoice_number' => array(
        'label' => t('Invoice number'),
        'description' => t('Display simple invoice number'),
        'weight' => -10,
      ),
      'created' => array(
        'label' => t('Created'),
        'description' => t('Display date of invoice creation'),
        'weight' => -5,
      ),
    ),
  );
  $order_field_instances = field_info_instances('commerce_order', 'commerce_order');
  if (!empty($order_field_instances)) {
    foreach ($order_field_instances as $field => $properties) {
      $extra['commerce_invoice']['commerce_invoice']['display'][$field] = array(
        'label' => t('Order: @label', array(
          '@label' => $properties['label'],
        )),
        'description' => $properties['description'],
        'entity' => 'commerce_order',
        'weight' => 0,
      );
    }
  }
  return $extra;
}