I have a site that shows upcoming football matches in a table, and I would like to include the clubs' logos next to each club name.
I have the following sections and entry types, both generated using an API and feedme to create entries
Teams section (includes fields for teamIDs and logos)
Matches section (includes fields for home team & home team ID, away team & away team ID, match time and location, but does not include logos)
The team ids and home/away team IDs match.
To display logos, I imagine the process should go something like this:
- for each hometeam and awayteam in each row of the match table, identify the team ID
- Use the ID to find the related teams in the teams section,
- output the asset (logo) related teams logo in the match table.
This feels like a relatedTo / reverse relations problem, where i can say - in twig - something like:
{% if homeTeamId or awayTeamId in the fixtures section is the same as a Teamid field in the Team Section, then output that related teams's logo. %}
Can anyone suggest the most efficient way to structure this in Twig?