Hello,

Please i have question , i want to display variables in twig file, i use dump and this is the result : 

array (size=16)
  0 => 
    array (size=1)
      0 => 
        array (size=1)
          'value' => string 'Emploi  & Stage' (length=15)
  1 => 
    array (size=1)
      0 => 
        array (size=4)
          'pid' => string '1' (length=1)
          'source' => string '/taxonomy/term/6' (length=16)
          'alias' => string '/home' (length=5)
          'langcode' => string 'en' (length=2)     ..........

But i dont know how to access to variable "alias" , i use but without result

{% for terms in terms_select %}
    {{ dump(terms) }}
    {{ terms['alias'] }}
{% endfor %} 

Thank you in advance

Comments

dibyajyoti.mallick’s picture

Hi,

Use this way, I think you find the result

{% for terms in terms_select %}
    {{ terms[1].alias}}
{% endfor %}

or you can check with nested loop:

{% for terms in terms_select %}
    {% for val in terms %}
    {{ val.alias }}

{% endfor %}

{% endfor %}

Thanks

patricia12’s picture

HI  dibyajyoti.mallick

Thank's for your reply, it works

Thank you again :)