diff --git a/.changeset/eighty-cameras-join.md b/.changeset/eighty-cameras-join.md new file mode 100644 index 00000000..92aaa277 --- /dev/null +++ b/.changeset/eighty-cameras-join.md @@ -0,0 +1,45 @@ +--- +"@wpengine/wp-graphql-content-blocks": minor +--- + +Added content resolver for CoreFootnotes when the post_meta isn't loaded + + +```gql +fragment CoreFootnotesBlockFragment on CoreFootnotes { + innerBlocks { + renderedHtml + } +} + +query Post($id: ID!) { + post(id: $id, idType: DATABASE_ID) { + databaseId + editorBlocks { + ...CoreFootnotesBlockFragment + } + } +} +``` + + +```json +{ + "data": { + "post": { + "databaseId": 16, + "editorBlocks": [ + {}, + { + "innerBlocks": [ + { + "renderedHtml": "
" + } + ] + }, + {} + ] + } + } +} +``` \ No newline at end of file diff --git a/includes/Blocks/CoreFootnotes.php b/includes/Blocks/CoreFootnotes.php new file mode 100644 index 00000000..2154d56b --- /dev/null +++ b/includes/Blocks/CoreFootnotes.php @@ -0,0 +1,27 @@ + [ + 'type' => 'string', + 'selector' => 'p', + 'source' => 'attribute', + 'attribute' => 'class', + ], + ]; +} diff --git a/includes/Data/ContentBlocksResolver.php b/includes/Data/ContentBlocksResolver.php index e4c589ad..6ebfe43d 100644 --- a/includes/Data/ContentBlocksResolver.php +++ b/includes/Data/ContentBlocksResolver.php @@ -152,6 +152,7 @@ private static function handle_do_block( array $block ): ?array { $block = self::populate_post_content_inner_blocks( $block ); $block = self::populate_reusable_blocks( $block ); $block = self::populate_pattern_inner_blocks( $block ); + $block = self::populate_core_footnotes_inner_blocks( $block ); // Prepare innerBlocks. if ( ! empty( $block['innerBlocks'] ) ) { @@ -292,6 +293,56 @@ private static function populate_pattern_inner_blocks( array $block ): array { } $block['innerBlocks'] = $resolved_patterns; + + return $block; + } + + /** + * Populates the innerBlocks for core/footnotes + * + * @param array