- Issue created by @brooke_heaton
- πΊπΈUnited States brooke_heaton
I see this issue has recently been resolved in the most recent versions.
I have a specific use case with a decoupled website that uses seperate domains for the frontend vs backend of the site. Problematically, when rendering links as a barcode, it is not possible to perform the required rewriting needed in a preprocess function nor in a template, as the barcode processing happpens already in the FieldFormatter. I'd like to be able to prepend the correct domain path PRIOR to the generation of the barcode and I've found this is best done by extending the Barcode FieldFormatter. Problematically, when I do this, I see a fatal error because for some reason the Barcode class id declared as 'final'. I don't see other contrib module FieldFormatters delcaring their FieldFormatter class as 'final', so I'm curious if there's a reason this is done and what the motivation is.
Enable the barcodes module and create a custom module with a FieldFormatter class that extends the Barcode FieldFormatter class. Add custom logic to process a compatible field, enable your module, set your field to use your custom FieldFormatter for its display. Attempt to view content with a populate field that should render with your custom FieldFormatter. You should see a fatal error that states "cannot extend final class Drupal\barcodes\Plugin\Field\FieldFormatter\Barcode"
Remove 'final' from the Barcode Class.
Active
2.1
Code
I see this issue has recently been resolved in the most recent versions.