Unless I'm missing something I should know, I think it'd be great to have some sort of an alter hook exposed for site administrators, so that they can build small modules to build the barcode field based on other values.

I work in EAN13 world and my preferred scenario would be to build a tiny module where I would use an alter hook to concatenate:

  • country code (3 digits)
  • manufacturer code (variable: 3 to 7 digits)
  • product code (remaining digits) - value of Serial Field padded with zeros.
  • [control digit calculated by Barcode]

Because an entity (usu. a node) can have multiple barcode fields (say, EAN13, UPC and QRCode), my suggestion would be to choose a hook naming scheme so to allow to distinguish which type or instance we are altering in our module. That's because we could want to alter EAN13, but not QRCode on the very same node. Therefore you might consider implementing a whole set of alter hooks such as:

  • hook_barcode_[BARCODE_TYPE]_[ENTITY_TYPE]_[FIELD_TYPE]_alter
  • hook_barcode_[BARCODE_TYPE]_[ENTITY_TYPE]_alter
  • hook_barcode_[BARCODE_TYPE]_alter
  • hook_barcode_[BARCODE_TYPE]_[FIELD_TYPE]_alter

Comments

moniuch’s picture

Issue summary: View changes

Reworded to better convey the idea

tr’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

This module is no longer supported, and feature requests like this will not be implemented. I suggest you try using the Barcodes module instead (https://www.drupal.org/project/barcodes)

Barcodes is very similar to this module, and is supported for Drupal 7, 8, and 9.