Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Filtering ACF options page by language #52

Closed
PSalaun opened this issue Jul 13, 2020 · 2 comments
Closed

Filtering ACF options page by language #52

PSalaun opened this issue Jul 13, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request todo after v4 release topic: WordPress Related to Gatsby's integration with WordPress

Comments

@PSalaun
Copy link

PSalaun commented Jul 13, 2020

Hi,

Current Problem
I'm using ACF and Polylang to handle my options pages. I've managed to get the GraphQL query work in WP, to get the options by language, using a filter:

query GET_HEADER_AND_FOOTER {
  themeSettings(language: EN) {
    acfHeaderAndFooter {
      cookiesLinkLabel
      copyright
      websiteCreator
    }
  }
}

but the schema in Gatsby is different, and I cannot filter by language or get a list of all the nodes for each language. I can only write this query, which will return only the default language node:

query GET_HEADER_AND_FOOTER {
  allWp {
    nodes {
      themeSettings {
        acfHeaderAndFooter {
          copyright
          websiteCreator
          cookiesLinkLabel
        }
      }
    }
  }
}

Possible solution
It would be great to be able to do something along the lines of

query GET_HEADER_AND_FOOTER {
  allWp {
    nodes {
      themeSettings(filter: { language: { eq: "EN" } } {
        acfHeaderAndFooter {
          copyright
          websiteCreator
          cookiesLinkLabel
        }
      }
    }
  }
}

or having the query returns nodes for every language with a language field, so I can filter in my code.

It is not a blocking issue, as I can just give up using Options and create a custom type for handling these settings. But the UI would be easier to understand for a content editor.

Thank you for all the work on this plugin!

Regards,
Pierre

@TylerBarnes
Copy link
Collaborator

Hi @PSalaun thanks for the feature request!
I agree that this is needed. My thought originally was to add a type option which will cause fields to be fetched multiple times with each value in an enum.
So in this case it could be something like:

{
  options: {
    type: {
      ThemeSettings: {
        fetchWithEnum: `LANGUAGE`
      }
    }
  }
}

Due to the way caching works in Gatsby we would only be able to do this for a single input field, otherwise the number of required fetches would get out of hand really quickly.

@TylerBarnes TylerBarnes added the enhancement New feature or request label Jul 14, 2020
@TylerBarnes TylerBarnes self-assigned this Jul 24, 2020
@TylerBarnes TylerBarnes added the topic: WordPress Related to Gatsby's integration with WordPress label Feb 5, 2021
@smthomas
Copy link
Contributor

Thank you for opening this issue. We recently moved this plugin over to the gatsbyjs monorepo and are trying to clean out this issue queue. We documented this feature to look at for a future roadmap item and are going to close this issue out. If you want to add additional visibility to this feature, you can request it at https://portal.gatsbyjs.com/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request todo after v4 release topic: WordPress Related to Gatsby's integration with WordPress
Projects
None yet
Development

No branches or pull requests

3 participants