From cb7bbe985a730c8335580e40a90d7f27c0584629 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Fri, 29 Mar 2024 12:43:53 -0400 Subject: [PATCH] feat: Block object attributes may have custom types with subfields --- .changeset/eight-steaks-yawn.md | 5 +++++ includes/Blocks/Block.php | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/eight-steaks-yawn.md diff --git a/.changeset/eight-steaks-yawn.md b/.changeset/eight-steaks-yawn.md new file mode 100644 index 0000000..844f760 --- /dev/null +++ b/.changeset/eight-steaks-yawn.md @@ -0,0 +1,5 @@ +--- +"@wpengine/wp-graphql-content-blocks": major +--- + +feat: Block object attributes may have custom types with subfields diff --git a/includes/Blocks/Block.php b/includes/Blocks/Block.php index 5914fef..6faa465 100644 --- a/includes/Blocks/Block.php +++ b/includes/Blocks/Block.php @@ -164,7 +164,11 @@ private function get_attribute_type( $name, $attribute, $prefix ) { } break; case 'object': - $type = Scalar::get_block_attributes_object_type_name(); + if ( isset( $attribute['properties'] ) ) { + $type = $this->get_query_type( $name, $attribute['properties'], $prefix ); + } else { + $type = Scalar::get_block_attributes_object_type_name(); + } break; } } elseif ( isset( $attribute['source'] ) ) {