You are here

function theme_commerce_invoice_number in Commerce Invoice 7.2

Themes an invoice number.

Parameters

array $variables: An array of variables containing 'sequence', 'key', and 'pattern_name'.

Return value

string A sanitized string.

See also

template_preprocess_commerce_invoice_number()

1 theme call to theme_commerce_invoice_number()
InvoiceNumber::__toString in src/InvoiceNumber/InvoiceNumber.php
Magic method to convert the invoice number to a string.

File

./commerce_invoice.theme.inc, line 41
Theme functions for the Commerce Invoice module.

Code

function theme_commerce_invoice_number(array $variables) {
  if (!strlen($variables['key'])) {
    $invoice_number = (string) $variables['sequence'];
  }
  elseif (strpos($variables['key'], InvoiceNumber::SEQUENCE_TOKEN) !== FALSE) {
    $invoice_number = str_replace(InvoiceNumber::SEQUENCE_TOKEN, $variables['sequence'], $variables['key']);
  }
  else {
    $invoice_number = $variables['key'];
    if (!empty($variables['sequence'])) {
      $invoice_number .= '_' . $variables['sequence'];
    }
  }
  return $variables['sanitize'] ? check_plain($invoice_number) : $invoice_number;
}