You are here

function commerce_invoice_token_info in Commerce Invoice 7

Implements hook_token_info().

File

./commerce_invoice.tokens.inc, line 12
Builds placeholder replacement tokens for invoice-related data.

Code

function commerce_invoice_token_info() {
  $type = array(
    'name' => t('Invoices', array(), array(
      'context' => 'a drupal commerce invoice',
    )),
    'description' => t('Tokens related to individual invoices.'),
    'needs-data' => 'commerce-invoice',
  );

  // Tokens for invoices.
  $invoice = array();
  $invoice['invoice-id'] = array(
    'name' => t('Invoice ID', array(), array(
      'context' => 'a drupal commerce invoice',
    )),
    'description' => t('The unique numeric ID of the invoice.'),
  );
  $invoice['invoice-number'] = array(
    'name' => t('Invoice number', array(), array(
      'context' => 'a drupal commerce invoice',
    )),
    'description' => t('The invoice number displayed to the customer.'),
  );

  // Refer to corresponding order from invoice
  $invoice['order'] = array(
    'name' => t('Order'),
    'description' => t('The order associated to the invoice.'),
    'type' => 'commerce-order',
  );
  return array(
    'types' => array(
      'commerce-invoice' => $type,
    ),
    'tokens' => array(
      'commerce-invoice' => $invoice,
    ),
  );
}