Assigning logo in twig file based on token attribute

More
1 month 1 day ago #170105 by Bigred01
Bigred01 created the topic: Assigning logo in twig file based on token attribute
Hey everyone.

I was wondering if anyone has found a non hacky way of setting template visuals like a brand logo based on a token attribute in a twig file.

Previously I would have referenced the sub-domain if it was branded or piped something in from the sample if it was accessible in the pstpl file or even did some js and updated the image based on an attribute, but I am unsure how to approach this in the new templating system.

I am trying to limit how often a template needs to be extended and have common needs like this built into my default template. Ideally I would like the survey admin to have the ability to specify a token attribute that can pipe in an image name.

Any ideas?

I can figure out a work around but more curious if someone has already found a solution.

Please Log in or Create an account to join the conversation.

More
1 month 15 hours ago #170119 by tpartner
tpartner replied the topic: Assigning logo in twig file based on token attribute
You can use this to access token attributes in twig files:

{{ processString('{strip_tags(TOKEN:ATTRIBUTE_1)}') }}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: LouisGac

Please Log in or Create an account to join the conversation.

More
1 month 9 hours ago #170174 by Bigred01
Bigred01 replied the topic: Assigning logo in twig file based on token attribute
Thanks tpartner. With that I was able to allow them to flag an attribute to be used as an image path/file name else default to what ever was set in the template options if nothing was set.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!