Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
I'm using Drupal 7. I got a text field telephone_number which of course stores phone numbers. In display mode I would like its contents to be displayed as a Colorbox Link which opens the relative autogenerated QR Code.
The Input Filter relative to the QR Code I would like to display is
[mobilecodes type="qr" data="phone" size="medium" name="Text here" tinyurl="0"]<strong>content</strong>[/mobilecode]
I though of Custom Formatters to modify how the field contents are displayed, to generate a Colorbox Link.
But I cannot figure out how to redirect the Colorbox to the autogenerated QR code.
May anyone please help me? :)
Comments
Comment #1
Deciphered CreditAttribution: Deciphered commentedTo generate a Mobile Code via an Advanced (PHP) Custom Formatter you would need to use the theme() function not the Filter format.
Comment #2
lsolesen CreditAttribution: lsolesen commentedWhat do you mean by redirect colorbox to autogenerated QR Code? Do you mean show the generated code in a colorbox? Please clarify your question, and maybe supply a screenshot on what result you are looking for.
Comment #3
cesareaugusto CreditAttribution: cesareaugusto commentedI try to explain it step by step. I got eg. a phone field. I would like to display it as a linked text. The text would be the field content itself. The link would open a colorbox with the QR code display of the same field.
Eg. I got a phone field whose content is "+393481234567". That should be displayed as a link. Clicking on that link would open a Colorbox with the QR code of "+393481234567".
How could I reproduce it?
Comment #4
Deciphered CreditAttribution: Deciphered commentedI've written a Custom Formatter for you which I believe will do what you're after, it uses the Colorbox, Mobile Codes and Phone modules to render a Phone field as a link to a Colorbox popup containing the QR Code.
You can find the code at http://customformatters.com/formatters/18/phonetoqr, either use the code, import the exportable into Custom Formatters or use the Drupal API version (after renaming the hooks).
Cheers,
Deciphered.
Comment #5
lsolesen CreditAttribution: lsolesen commented@Deciphered Thanks for the answer. Setting status to fixed.
Comment #7
javdich CreditAttribution: javdich commentedI know this is already set as closed, but I'm trying to print the QR code directly to the page instead of using the colorbox as per your example at http://customformatters.com/formatters/18/phonetoqr
Im using the example code for now and its working, but the link to bring up the qr code is just one extra step, which I would like to eliminate. Any help would be much appreciated.
Kind Regards.
Comment #8
cesareaugusto CreditAttribution: cesareaugusto commented@Deciphered: Would it be possible to add the international code to the QR? At present it parses only the number itself, no international prefix...