-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added block and content resolver for CoreFootnotes
Added content block resolver for getting post meta for footnotes.
- Loading branch information
1 parent
b133a1b
commit 6ae09aa
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
"@wpengine/wp-graphql-content-blocks": patch | ||
--- | ||
|
||
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": "<ol class=\"footnotes\"><li id=\"d4051e5e-1547-49ff-ab6d-bec1caa6aabc\"><a href=\"https://wpengine.com/about-us/\">https://wpengine.com/about-us/</a></li><li id=\"2e79de23-68a8-42eb-87ab-1f2467a21752\"><a href=\"https://wpengine.com/support/\">https://wpengine.com/support/</a></li></ol>" | ||
} | ||
] | ||
}, | ||
{} | ||
] | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* Core Paragraph Block | ||
* | ||
* @package WPGraphQL\ContentBlocks\Blocks | ||
*/ | ||
|
||
namespace WPGraphQL\ContentBlocks\Blocks; | ||
|
||
/** | ||
* Class CoreParagraph | ||
*/ | ||
class CoreFootnotes extends Block { | ||
/** | ||
* {@inheritDoc} | ||
* | ||
* @var array|null | ||
*/ | ||
protected ?array $additional_block_attributes = [ | ||
'cssClassName' => [ | ||
'type' => 'string', | ||
'selector' => 'p', | ||
'source' => 'attribute', | ||
'attribute' => 'class', | ||
], | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters