I’ve created a social media structure
in a section
that is then being used on the site.yml
blueprint where users can add new social media options that then display on social media
fields across the rest of the site:
setsocial:
label: Set Social Platforms
type: structure
fields:
platformname:
label: Platform Name
type: text
fillicon:
label: Platform Icon Fill
type: files
help: Make sure the icons have a transparent background!
max: 1
buttonicon:
label: Platform Icon Button
type: files
max: 1
inverticon:
label: Platform Icon Inverted
type: files
max: 1
and am now trying to call the platformname
field as a select query in my social media
field blueprint like so:
label: Social
type: structure
fields:
platform:
label: Platform
type: select
width: 1/2
options: query
query:
fetch: site.setsocial.toStructure
text: "{{ site.platformName }}"
url:
label: URL
type: text
width: 1/2
If I leave the query as site.setsocial.toStructure
all I get are blank slots. Having asked how to do something similar with a structure with dates I created. I tried using a page method but am having trouble getting it to display either . It doesn’t seem to be working neither on the front-end or the back-end.
'platformName' => function() {
foreach($this->setsocial()->toStructure() as $item) {
return $item->platformname();
}
}
Am I going about this the right way?