0

I'm trying to embed views like this:

 views_embed_view('articles_list', 'block_1', '11+13');

If I type 11 in arguments, it does take the argument. It works good if I preview the view and enter '11+13' in "Preview with contextual filters" field... But if I write '11+13' in the views_embed_view() function, it just takes the value of 11. How can I make it work and take both values: 11 and 13?

2

From views_embed_view doc comment block:

  • @param ...
    • Any additional parameters will be passed as arguments.

That means any params comes after params $name and $display_id will consider as contextual filer so you should call views_embed_view like:

views_embed_view('articles_list', 'block_1', '11', '13');

Take a look at Twig Views Module do the same.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.