function barcodes_theme in Barcodes 7
Same name and namespace in other branches
- 8 barcodes.module \barcodes_theme()
- 2.0.x barcodes.module \barcodes_theme()
Implements hook_theme().
File
- ./
barcodes.module, line 407 - Contains barcodes.module.
Code
function barcodes_theme($existing, $type, $theme, $path) {
$generator = new BarcodeGenerator();
$barcode = array(
'variables' => array(
'svg' => NULL,
'type' => NULL,
'value' => NULL,
'width' => NULL,
'height' => NULL,
'color' => NULL,
'padding_top' => NULL,
'padding_right' => NULL,
'padding_bottom' => NULL,
'padding_left' => NULL,
'show_value' => NULL,
),
);
$items = array();
$items['barcode'] = $barcode;
$items['barcode']['template'] = 'barcode';
$items['barcode']['path'] = drupal_get_path('module', 'barcodes') . '/templates';
foreach ($generator
->getTypes() as $type) {
$suffix = str_replace('+', 'plus', strtolower($type));
$items['barcode__' . strtolower($type)] = $barcode;
$items['barcode__' . strtolower($type)]['template'] = 'barcode--' . $suffix;
$items['barcode__' . strtolower($type)]['path'] = drupal_get_path('module', 'barcodes') . '/templates';
}
return $items;
}