wp-graphql / wp-graphql-acf

WPGraphQL for Advanced Custom Fields
https://wpgraphql.com/acf
626 stars 123 forks source link

Expose label name of ACF field #321

Closed RodrigoTomeES closed 11 months ago

RodrigoTomeES commented 2 years ago

Hi,

Could be expose the label name of a ACF field?

imagen

jT2a commented 1 year ago

I'm looking for this as well

jasonbahl commented 11 months ago

@jT2a What field type(s) would you expect this to work for?

We're rebuilding this plugin over here: https://github.com/wp-graphql/wpgraphql-acf and we have an open issue to discuss returning the label and value for choice fields (Select, Checkbox, Radio) but we're not considering it for all field types.

Could you maybe provide more information on what use cases might be for this?

RodrigoTomeES commented 11 months ago

Hi, @jasonbahl if I remember it well I needed the labels for not hardcore the label name in the front end. My idea was to get all fields and loop over the object to get a pair key value, where the key is the label and the value is the value.

jasonbahl commented 11 months ago

@RodrigoTomeES thanks for the response!

I think at this time we do not plan to expose the label of each field in the graph.

We might consider this in the future. . .exposing a way to query the ACF Field Group and Fields as objects themselves with things like the field settings that make up the config for fields, but for the moment the focus of WPGraphQL for ACF is exposing data similar to what you would get with get_field(), but via GraphQL.

I'm going to close this as I don't think it's something we will be working on anytime soon.

You can always use APIs like register_graphql_field and register_graphql_object_type, etc to add new fields to the Schema and expose data such as field labels that might be helpful for your applications. 🙏🏻