Git Product home page Git Product logo

Comments (4)

Log1x avatar Log1x commented on August 26, 2024

What are you expecting when adding them to admin_cols? For a true/false value to show up in the Post list screen?

In any case, I don't think this is related to Poet.

from poet.

troyblakelydc avatar troyblakelydc commented on August 26, 2024

We have a custom post type called "release" that we have flagged to 'show_in_graphql' as shown below. This successfully adds the custom post type to the GQL schema. Everything works there.

'post' => [
'release' => [
'supports' => ['title', 'thumbnail'],
'show_in_rest' => true,
'labels' => [
'singular' => 'Release',
'plural' => 'Releases',
],
'admin_cols' => [...]
],
'show_in_graphql' => true,
'graphql_single_name' => 'release',
'graphql_plural_name' => 'releases',
],

However, each custom field that you want exposed to the GQL schema also needs to be explicitly added. The documentation shows this being done as the field group is added to ACF. I'm not sure if/how this might map into poet. I tried adding it into the admin_cols section both as an attribute of admin_cols, and as attributes of a give field and neither one worked. My goal is to see the custom fields (in this example case "artist") in the GQL schema, so I could query them like so:

query GetPosts { releases { nodes { artist } } }

'admin_cols' => [
'artist' => ['post_field' => 'artist',
'meta_key' => 'artist',
'show_in_graphql' => true,
'graphql_field_name' => 'artist_group',],
...
],
'show_in_graphql' => true,
'graphql_field_name' => 'admin_cols',
],

from poet.

Log1x avatar Log1x commented on August 26, 2024

Sorry for the late reply.

This wouldn't be related to Poet. admin_cols simply lets you add more columns to the list of posts in the backend.

You need to add show_in_graphql to your field group its self when registering it.

If you're using ACF Composer, you can do it when you initialize FieldsBuilder like this:

$example = new FieldsBuilder('example', [
    'show_in_graphql' => true, 
    'graphql_field_name' => 'My field name',
]);

from poet.

troyblakelydc avatar troyblakelydc commented on August 26, 2024

We ended up calling register_graphql_fields and acf_add_local_field_group and register_post_type in setup.php. Less concise, but it worked!

from poet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.