Using the barcode field formatter
This documentation needs work. See "Help improve this page" in the sidebar.
Out-of-the-box, the Barcodes module supports all of the standard string and numeric fields that come bundled in Drupal core. These are:
- integer
- link
- string
- telephone
- text
- text_long
- text_with_summary
- bigint
- uuid
But Barcodes can be extended to apply to any field that holds data that can be encoded into a barcode of the type you choose.
The standard way to customize Drupal for your site is to implement a hook. If you wanted to add support for the "serial" field type, for example, you could implement a hook like this:
/**
* Implements hook_field_formatter_info_alter().
*/
function yourmodule_field_formatter_info_alter(array &$info) {
// Allow the barcode field formatter to be used on a new field type.
$info['barcode']['field_types'][] = 'serial';
// You may add additional lines for each field type you want to support.
$info['barcode']['field_types'][] = 'temperature';
}Details of how to implement a hook for your site is out-of-scope of this documentation guide, but you can read the official Drupal documentation on how to implement a hook for details. (need link here)
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion