Skip to content

Commit

Permalink
fix: #159 - ${PostType}EditorBlock Interfaces registered and implemen…
Browse files Browse the repository at this point in the history
…ted with different names (#160)

* fix: #159 - ${PostType}EditorBlock Interfaces registered and implemented with different names

Instead of using the Post Type's name to register Interface Types, this uses the Post Type's graphql_single_name to register the Interface Types, which is consistent with what is used to implement the Types as Interfaces.

* chore: add changeset

---------

Co-authored-by: John Parris <[email protected]>
  • Loading branch information
jasonbahl and mindctrl authored Nov 29, 2023
1 parent 2d793cf commit be7a34f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/violet-phones-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wp-graphql-content-blocks": patch
---

Interface Types are now registered with the Post Type's `graphql_single_name`, instead of the Post Type's `name`. Fixes a bug where invalid Types were registered.
2 changes: 1 addition & 1 deletion includes/Registry/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static function ( $post_type ) {
// For each Post type
foreach ( $supported_post_types as $post_type ) {
// Normalize the post type name
$type_name = WPGraphQLHelpers::format_type_name( $post_type->name );
$type_name = Utils::format_type_name( $post_type->graphql_single_name );

// retrieve a block_editor_context for the current post type
$block_editor_context = WPHelpers::get_block_editor_context( $type_name, $post_id-- );
Expand Down

0 comments on commit be7a34f

Please sign in to comment.