Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Concatenate twig functions

  • AritzP
  • AritzP's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #211825 by AritzP
Concatenate twig functions was created by AritzP
Hi everyone!

We are trying to put a different logo on the nav-bar depending of the user's logo attribute. So we have created an attribute which reads the name of the logo.

On the theme's editor, we can take that value with 'processString("{TOKEN:ATTRIBUTE_1}")'.

The problem is that I am trying to insert that code on {{ image('./files/processString("{TOKEN:ATTRIBUTE_1}").png', 'Logo', {"class": "logo img-responsive"}) }} but it doesn´t work. I have tried this way too: {{ image('./files/', processString("{TOKEN:ATTRIBUTE_1}"), '.png', 'Logo', {"class": "logo img-responsive"}) }}

Is there any way to use the attribute value on {{ image }} function?

I am using 3.17 version of Limesurvey

Thanks for your time!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 months ago #211827 by DenisChenu
Replied by DenisChenu on topic Concatenate twig functions
Code:
{% set imageFile = './files/' ~ processString("{TOKEN:ATTRIBUTE_1}")~ '.png' %}
{{ image(imageFile, 'Logo', {"class": "logo img-responsive"}) }}
maybe

See
twig.symfony.com/doc/2.x/templates.html#twig-expressions
twig.symfony.com/doc/2.x/tags/set.html

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: AritzP
The topic has been locked.
  • AritzP
  • AritzP's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 months ago #211843 by AritzP
Replied by AritzP on topic Concatenate twig functions
It works like a charm, thanks Denis!!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose