You are here

function theme_barcode_image in Barcode 6.2

Same name and namespace in other branches
  1. 7.2 barcode.module \theme_barcode_image()

Theme function for the barcode image.

2 theme calls to theme_barcode_image()
barcode_example_form in modules/barcode_example/barcode_example.module
theme_barcode_formatter_default in ./barcodefield.module
Theme function for 'default' barcode field formatter.

File

./barcode.module, line 83

Code

function theme_barcode_image($barcode_value, $encoding = NULL) {
  if (empty($barcode_value)) {
    return '';
  }
  $barcode = barcode_get_settings();
  $barcode['value'] = $barcode_value;
  if (isset($encoding)) {
    $barcode['encoding'] = $encoding;
  }
  module_load_include('inc', 'barcode', 'includes/barcode.plugins');
  $filename = barcode_generate_image($barcode);
  if (!$filename) {
    drupal_set_message(t('An error occured while generating the barcode.'), 'error');
    return '';
  }
  return theme('image', $filename, $barcode_value, $barcode_value, array(
    'class' => 'barcode',
  ));
}