Created on 26 March 2019, about 6 years ago
Updated 28 April 2025, 22 days ago

We can currently call a view by machine name and view (eg. page, block, etc.). It would be ideal if we could pass an argument in the call. E.G.

{{ bamboo_render_views('machine_name','page_1',2) }}

The specific use case would be in embedding the view in a template that is for an entity reference. Currently, if you have a view that uses a Contextual Filter of the node ID (nid), and this is set to get the value from the URL, then the view will get the 'top-level' ID rather than the entity_reference ID.

If we could pass arguments, we could use:

{{ bamboo_render_views('machine_name','page_1',node.nid.value) }}

because the template will use the ID for the node that relates to the template.

to clarify:

Node 1 <-NID = 1
---> Entity Reference > Node 2 <- NID = 4
------->Entity Reference > Node 3 <- NID = 8 (we want this NID)

The beauty of this would be that it would not matter how many layers of nested references you have, you could pass a simple argument to the {{ bamboo_render_views... }} and get the behaviour you want. This obviates the need to create very complex views, using multiple 'references' within the view.

Is this possible?

Thanks

✹ Feature request
Status

Needs work

Version

3.3

Component

Code

Created by

🇬🇧United Kingdom gmak

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the “VDC” tag instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom jpontet

    Is this any news on this adding this feature @wengerk?
    It would be extremely useful for us too.
    Perhaps it's not going to happen as this issue is so old.

  • 🇚🇭Switzerland wengerk Lausanne

    Thanks for checking in on this feature request. This would indeed be a valuable addition to the module, allowing for more flexible view rendering with contextual arguments.

    • I'm open to any contribution and willing to review and help make it merged
    • I don't have time for now to work on it but maybe in a few months
    • If this feature is critical for your use case, please let me know
Production build 0.71.5 2024