0
votes

I am having a view1 twig template. I want to pass the field [field_program_id] in the URL field so it will be reaching contextual filter of view2. My link field on view 1 is:

<a class="button js-form-submit form-submit btn-info btn" type="button" value="LEARN MORE" href=/program-search/details/{{ field_program_id }}>LEARN MORE</a>

'program-search/details' is the path of view 2. So when I select program ID = 155, I want the learn more button to create the URL as /program-search/details/155 . But currently the 155 is not getting passed correctly. Any help?!

Screenshot of my page: https://imgur.com/a/yI1Zqik

When I click on the 'Learn more' button I want to pass the Program ID through 'href'

1
where do you render/pass to the view? lets see that - delboy1978uk
Do you want to see the entire twig file or the front end? can attach a screenshot in a sec - Rick
no i want to see the php code that passes field_program_id to twig - delboy1978uk

1 Answers

0
votes

What if you use string interpolation and build the whole url at once?

<a class="button js-form-submit form-submit btn-info btn" type="button" value="LEARN MORE" href={{ "/program-search/details/#{field_program_id}" }}>LEARN MORE</a>