I’m working on a festival site that has event listings. Each event has different sponsors, and some sponsors are festival wide and should be displayed on the home page. I’ve set up a universal sponsor blueprint with a boolean to pull festival sponsors onto the home page:
Sponsors blueprint:
sponsors:
label: "Sponsors & Special Thanks"
type: structure
help: Use a .png with transparent background for sponsor logo file.
fields:
sponsor_name:
label: Sponsor name
type: text
sponsor_logo:
icon: file-image
label: Sponsor logo
type: files
max: 1
sponsor_link:
label: Sponsor website
type: url
sponsor_level:
label: Sponsor level
type: select
options:
- "CMYK"
- "Duotone"
- "Spot Color"
- "Studio Tour"
- "Special Thanks"
- "Community Partner"
sponsor_home:
label: "Display on home page?"
type: toggle
text:
- "No"
- "Yes"
On the individual event pages, I’m querying the sponsor structure field to select event sponsors from the main list:
event_sponsors:
label: Event Sponsors
type: multiselect
options: query
query:
fetch: site.find('sponsors').sponsors.toStructure
text: "{{ structureItem.sponsor_name }}"
value: "{{ structureItem.sponsor_name.slug }}"
help: Add sponsors via the sponsors and special thanks section on the panel landing page.
In my snippet, no issues filtering the sponsors that should be displayed on the home page. But I’m not sure how to filter the structure field / pull in the event specific sponsors from the multiselect field.
<?php
// Check for home page
if($page == page('home')) $sponsors = page('sponsors')->sponsors()->toStructure()->filterBy('sponsor_home', 'true');
// If not home page, pull event sponsors
else($sponsors = $page->event_sponsors() [HELP] );
?>