问题描述
register_graphql_object_type('GroupBottomImage',array(
'fields' => array(
'bottomImageOne' => array(
'type' => 'MediaItem'
),'bottomImageTwo' => array(
'type' => 'MediaItem'
),'fieldGroupName' => array(
'type' => 'String'
)
)
) );
register_graphql_field( 'Page','bottomImages',array(
'resolve' => function( $page ) {
return array(
'bottomImageOne' => get_field( 'bottom_image_one',$page ),'bottomImageTwo' => get_field( 'bottom_image_two','fieldGroupName' => 'bottomImages'
);
},'type' => 'GroupBottomImage'
) );
get_field( 'bottom_image_one,$page' )
返回一个带有图像数据(ACF 图像类型)的对象,但在 register_graphql_object_type
中我指定它需要是“MediaItem”类型。是否可以将 get_field( ... )
的结果转换为“MediaItem”类型?如果是这样,我该怎么做?我在文档中找不到任何相关信息。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)