barcodes.module in Barcodes 8
Same filename and directory in other branches
Contains barcodes.module.
File
barcodes.moduleView source
<?php
/**
* @file
* Contains barcodes.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Com\Tecnick\Barcode\Barcode as BarcodeGenerator;
/**
* Implements hook_help().
*/
function barcodes_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the barcodes module.
case 'help.page.barcodes':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Generate Barcodes') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
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;
}
Functions
Name | Description |
---|---|
barcodes_help | Implements hook_help(). |
barcodes_theme | Implements hook_theme(). |