You are here

function barcodes_theme in Barcodes 8

Same name and namespace in other branches
  1. 7 barcodes.module \barcodes_theme()
  2. 2.0.x barcodes.module \barcodes_theme()

Implements hook_theme().

File

./barcodes.module, line 30
Contains barcodes.module.

Code

function barcodes_theme($existing, $type, $theme, $path) {
  $generator = new BarcodeGenerator();
  $barcode = [
    'variables' => [
      'type' => NULL,
      'format' => NULL,
      'value' => NULL,
      'width' => NULL,
      'height' => NULL,
      'color' => NULL,
      'padding_top' => NULL,
      'padding_right' => NULL,
      'padding_bottom' => NULL,
      'padding_left' => NULL,
      'show_value' => NULL,
      'extended_value' => NULL,
      'svg' => NULL,
      'png' => NULL,
      'htmldiv' => NULL,
      'unicode' => NULL,
      'binary' => NULL,
      'barcode' => NULL,
    ],
  ];
  $items = [];
  $items['barcode'] = $barcode;
  foreach ($generator
    ->getTypes() as $type) {
    $suffix = str_replace('+', 'plus', strtolower($type));
    $items['barcode__' . $suffix] = $barcode;
  }
  return $items;
}