Pull From Social Media Options Structure on Site.Yml

I’ve created a social media structurein 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?

Should be

 query: 
      fetch: site.setsocial.toStructure
      text: "{{ structureItem.platformName }}"
      value: "{{ structureItem.platformName }}"

Damn okay, I totally missed that one. Thanks for pointing it out.

Unrelatedly, for a files field, is there a way to filter out files that have already been selected? I figure it can be done using filterBy but I can’t find any documentation on how to pull out that info.

This should work, at least outside a structure field.

query: page.images.not(page.fieldname.toFiles)

Ah it is within a structure field so I’m probably gonna have to create a page method for that as well.