- Posts: 88
- Thank you received: 33
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Assigning logo in twig file based on token attribute
- Bigred01
- Topic Author
- Offline
- Premium Member
Less
More
5 years 10 months ago #170105
by Bigred01
Assigning logo in twig file based on token attribute was created by Bigred01
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.
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.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
5 years 10 months ago #170119
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Assigning logo in twig file based on token attribute
You can use this to access token attributes in twig files:
Code:
{{ 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 topic has been locked.
- Bigred01
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 33
5 years 10 months ago #170174
by Bigred01
Replied by Bigred01 on 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.
The topic has been locked.