In Drupal 8.9x, I have a view with two content types in it: Each business (and its details are grouped), and underneath each business I'm displaying multiple offers by that business...and then I want to display more business details underneath that.
For example:
Business #1 "title"
-- offer A for business #1 (row)
-- offer B for business #1 (row)
Business #1 Details (ideally inserted via the twig template)
Business #2 "title"
-- offer C for business #2 (row)
-- offer D for business #2 (row)
Business #2 Details (ideally inserted via the twig template)
I've got my view set up so that ALMOST all of the business details are grouped into a custom field. This outputs as "title" in the views-view-unformatted.html.twig
template file, and all the offers are the "rows" that are placed inside the default twig for loop. The problem is, I need to place more business details after the for loop, and I don't know how to reliably insert that data via the template.
For example, if I try to access the Business's nid:
{% set bizNid = rows[0].content['#row'].node_field_data_node__field_business_location_nid %}
This grabs the very first row in the array, which doesn't necessarily correspond with the first business in the list. I spend a few hours looking through the twig var dump to see if I could find a reliable way of extracting the nid, but I just can't figure it out. My question is, how can I access the grouped/relationship data/fields/content inside a twig template file so I can sandwich the businesses offers between two sets of business data from the same business?
Here's a gist of my views-view-unformatted.html.twig file for more insight on what I'm trying to do.
And here's a screenshot of ultimately what the output should look like:
And here's a screenshot off my Views config page for "offers":
Thanks in advance for your help.