Variables in parameter field (view)
-
Hi, community!
I’m trying to get information from a view in my Contacts Entity but it seems that using a variable on the parameters field is not working with Twig templates. We extract the email of a list of clients using a PHP function inside a shortcode, it returns the email as a string. Here is our code, inserted using the Code Module from Divi (theme) :
[msdyncrm_twig]
{% set emailuser = “[get_email]” %} // The [get_email] is the custom shortcode. The sentence with quotes returns the email as a string, we checked with dump().
{% view entity=”contact” name=”EXAMPLE VIEW” count=”1″ parameters=[emailuser] %} // We use the variable emailuser to indicate that there is the email of the user as a string
{% for recordId, record in entityview.rows %}
Hi, {{ record.fullname.value }}
{% endfor %}
{% endview %}
[/msdyncrm_twig]
The problem is that the variable “emailuser” inside the parameters field is not working because I never get the information. If we execute the function {{dump(emailuser)}} it shows the email as a string.
We set the filter on the view as {0} and, if we use any email (for example, “[email protected]”), we can display de information of the contact.
Its possible to pass a variable as a parameter in Twig’s view template?
Thanks!
- The topic ‘Variables in parameter field (view)’ is closed to new replies.