- Issue created by @claudioasaez
- Status changed to Fixed
10 months ago 6:24am 26 January 2024 - πΊπΈUnited States tr Cascadia
The Barcodes module provides a Block and a Field Formatter. Both have settings options for the image format. SVG is default, but you can choose PNG if that's what you want.
- π¦π·Argentina claudioasaez
Yes, I know, but I am using display suit and generating the QR based on a link that I created for the presentation of the node. For this reason I use |barcode.
I don't want to add a field just to get something I already have, which is the link to the entity's pdf view mode
- Status changed to Active
10 months ago 5:06am 27 January 2024 - πΊπΈUnited States tr Cascadia
Sorry, I totally missed that because I forgot this module provides a TwigFilter!
The filter does allow you to pass in some arguments currently, but it's not documented and the image format is not one of the options.
I propose that we enhance the filter so that in your template you can pass values for ANY of the barcode settings. And in any order, because to do otherwise would make it a lot harder to use. Using it would look something like this:
{{ custom value|barcode({'type' : 'QRCODE', 'format' : 'PNG'}) }}
Where if you didn't provide any arguments, it would still do the same thing it currently does (which uses the default arguments), but if you wanted to change 1 or more of the settings you would pass the setting and the value as array elements to the
barcode
filter. And because the barcode filter accepts tokens, you could even pass a token value in for any of the settings.Does that sound like a good plan?
I think the README and the project page needs to be changed to mention that this module provides a Block and a TwigFilter, and we need to create a documentation guide for this project to start documenting how to use it and to give some examples.
Honestly, I'm not sure how much time I have to work on this right now, so if you have the ability to do some of this that would be great - I would be happy to review and commit any progress toward this.
- First commit to issue fork.
- last update
9 months ago 7 pass - last update
9 months ago 7 pass - Status changed to Needs review
9 months ago 4:07pm 4 February 2024 - πΊπΈUnited States tr Cascadia
MR16 is now rebased against the latest 2.1.x branch.
I made a few changes for coding standards.
I removed the
getName()
method, since that is not a method that is defined onAbstractExpression
and is not a method that is used by Twig. The name of the filter is actually only defined by the first argument of thenew TwigFilter()
call.I added parameter typing and return type hints to all methods.
I added a default case to the filter, to handle cases when the 'format' specified is unknown. I have the filter returning an empty string in the default case. I don't know if it would be better to throw an exception? Regardless, the method needs to return a string and having a default case documents what is intended to happen with the format is unknown.
- Status changed to Fixed
3 months ago 8:27pm 27 August 2024 - πΊπΈUnited States tr Cascadia
I also wrote up a documentation page on how to use the Twig filter, including these new changes.
https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib... β
Automatically closed - issue fixed for 2 weeks with no activity.