-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not works with Acf crop image plugin #67
Comments
I would love for this plugin to work with wpgraph-ql. Any progress on this happening any time soon? |
I included the field 'image_crop' slug in the class-config.php
but I don't remember if it worked. I'll install the project again here and see if it's working |
Any custom extensions of ACF would need to be mapped to the WPGraphQL Schema. There's no programmatic way (that I can think of right now) to automatically have custom ACF Extensions work in the GraphQL Schema. I'm open to suggestions if someone has an idea on how to get custom extensions to work automatically. |
If anyone has this problem still and needs a quick fix you can add 'image_aspect_ratio_crop' into the $supported_fields array (mentioned above by @dinho-afsn ) in /src/class-config.php. In the same file further down in a switch statement you also need to include it there where the 'image' and 'file' case are set. This would get removed though if you update the plugin. Thanks for the plugin @jasonbahl and if a solution was found to add this automatically that would be awesome! |
Good news, I have added support for this plugin in the latest version of ACF Image Aspect Ratio Crop plugin. I’m not sure if the implementation is 100% correct but it seemed to work fine in my testing. It would be nice to have some kind of documentation how to implement support for this plugin in a 3rd party ACF field. |
👋🏻 We're re-building this plugin over here: https://github.com/wp-graphql/wpgraphql-acf and in the new version we have a new API for mapping ACF Field Types to the GraphQL Schema. The new version of the plugin has built-in support for ACF Extended (free and PRO), which uses the new API for mapping custom ACF Field Types to the GraphQL Schema. It's not fully documented yet, but you can see plenty of examples of using the new Here's also a GIST showing how @CesarBenavides777 mapped the ACF Table field type to the GraphQL Schema: https://gist.github.com/CesarBenavides777/79b158db8355ddbc349fbf9b3272ae47 |
Where actually should this be updated? |
@flyingcodeeurope I'm not sure I follow? Are you using the new version of WPGraphQL for ACF v2.0? If so you can use the You can put the code wherever you maintain custom code. Typically the functions.php of a child theme or a custom plugin. |
@jasonbahl I am looking for a way to use the ACF Image Crop in Grapql, but did not understand where to put the above code. Might be old? In this guide, https://acf.wpgraphql.com/adding-support-for-3rd-party-acf-field-type/ how do I add it? |
Ya you'll need to add the code wherever you maintain custom code. Typically in WordPress you would use either a child theme or a custom plugin. |
@jasonbahl thats fine, its just that I cant figure out how to make it return the url. Its just giving me, |
@flyingcodeeurope is the value an ID of an image? If so you could get inspiration from how the Image field does things: https://github.com/wp-graphql/wpgraphql-acf/blob/develop/src/FieldType/Image.php I'm not familiar with the Image Crop acf field type enough to know how to best support it. I think my best advice would be to draw inspiration from other fields we are supporting and implement in a similar way. If you have a clear idea of how you would like it to show in the Schema but aren't quite sure how to get it there let me know |
@jasonbahl I know I want it to output it as url only. Not 100% sure how to achieve that... I played around with the code and actually managed what I wanted. Thank you for your great help pointing me in the right direction. |
Can you show how you did it? I'm struggling, trying to get the entire image object though... |
@robkrause this is my full code to add it to graphql: `<?php use GraphQL\Type\Definition\ResolveInfo; add_action( 'wpgraphql/acf/registry_init', function() {
});
|
@flyingcodeeurope thanks so much! I was already on the right path but was missing the |
I try use https://github.com/andersthorborg/ACF-Image-Crop . but not show in graphql.
The text was updated successfully, but these errors were encountered: