Closed sunilsingh2019 closed 1 year ago
Hi, did you find any solution to show the image URL instead of ID? Thank you
That can be fix you should extend function use this to get image
` // handle acf image field if($fieldObject && $fieldObject['type'] == 'image'){ $imageId = $attributes['data'][substr($key, 1)]; // get media item $img = wp_get_attachment_image_src($imageId, 'full'); $image_alt = get_post_meta($imageId, '_wp_attachment_image_alt', TRUE); $image_title = get_the_title($imageId);
if($fieldObject['return_format'] == 'url'){
$attributes['data'][substr($key, 1)] = $img[0];
}else if($fieldObject['return_format'] == 'array'){
$attributes['data'][substr($key, 1)] = array(
'id' => $imageId,
'url' => $img[0],
'width' => $img[1],
'height' => $img[2],
'resized' => $img[3],
'alt' => $image_alt,
'title' => $image_title
);
}else if($fieldObject['return_format'] == 'id'){
$attributes['data'][substr($key, 1)] = $imageId;
}
}`
Thank you for your reply, but I am not sure where to put this code. It would be so helpful if you could give me more detail, please?
Thank you for your reply, but I am not sure where to put this code. It would be so helpful if you could give me more detail, please?
Hi This plugins looks extended use this one https://github.com/tomphill/wp-graphql-gutenberg
Hello, from what I can tell this issue is not related to WPGraphQL for ACF as this plugin does not expose a blocksJSON
field.
From what I can tell this is an issue related to wp-graphql-gutenberg, which I believe is no longer maintained.
I would recommend checking out WPGraphQL Content Blocks by the WP Engine team: https://github.com/wpengine/wp-graphql-content-blocks
It might not have all features you're looking for (yet) but it's the most supported GraphQL + Gutenberg implementation I know of and the one I'm hoping stabilizes to the point where we might consider it for core WPGraphQL one day. 🙏🏻
I have created custom acf blocks other fields render fine but image field rendering values number find image for example
attributes: data: button: {title: 'DOWNLOAD RESUME', url: 'http://example.com.au/app/uploads/2022/12/SUNIL-SINGH2022.pdf', target: ''}enable_disable_module: "1"heading_1: "SUNIL "heading_2: "SINGH"hero_image: 17sub_heading: "I AM A FULL STACK WEB DEVELOPER"_button: "field_6345f391a8325"_enable_disable_module: "field_6346010b6dd8f"_heading_1: "field_6345ef9305807"_heading_2: "field_6345f52cfbe6e"_hero_image: "field_6345f1ce05809"_sub_heading: "field_6345f1a105808"[[Prototype]]: Objectmode: "edit"name: "acf/hero-module"