pristas-peter / wp-graphql-gutenberg-acf

Expose acf blocks through graphql
MIT License
62 stars 29 forks source link

ACF repeater structure #35

Closed jonnymaceachern closed 2 years ago

jonnymaceachern commented 2 years ago

CleanShot 2022-05-11 at 11 52 54

Can I adjust my query so that the returned repeater fields are nested hierarchically, as opposed to the flat, key-dependent structure pictured in the screenshot?

jonnymaceachern commented 2 years ago

I fixed my issue.

I hadn't enabled the setting that exposes the ACF field group that my block was using:

CleanShot 2022-05-11 at 15 13 54

I've gone ahead and enabled this setting, provided it a name (acf), and updated my query:

query Page {
  page(id: "1", idType: DATABASE_ID) {
    ... on AcfSliderBlock {
      acf {
        slides {
          body
          heading
          link {
            target
            title
            url
          }
        }
      }
    }
  }
}