-
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.
- Loading branch information
1 parent
169bf85
commit 39293c9
Showing
1 changed file
with
58 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,58 @@ | ||
--- | ||
"@wpengine/wp-graphql-content-blocks": minor | ||
--- | ||
|
||
Adds support for specifying typed and queryable properties for object attributes in block.json. | ||
|
||
Example: Defining a Typed Object in `block.json`: | ||
|
||
```json | ||
"attributes": { | ||
"film": { | ||
"type": "object", | ||
"default": { | ||
"id": 0, | ||
"title": "Film Title", | ||
"director": "Director Name", | ||
"__typed": { | ||
"id": "integer", | ||
"title": "string", | ||
"director": "string", | ||
"year": "string" | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
In this example, the `film` attribute is an object with defined types for each property (`id`, `title`, `director`, and optionally `year`). | ||
|
||
Querying Object Properties in GraphQL: | ||
|
||
|
||
```graphql | ||
fragment Film on MyPluginFilmBlock { | ||
attributes { | ||
film { | ||
id, | ||
title, | ||
director, | ||
year | ||
} | ||
}, | ||
} | ||
|
||
query GetAllPostsWhichSupportBlockEditor { | ||
posts { | ||
edges { | ||
node { | ||
editorBlocks { | ||
__typename | ||
name | ||
...Film | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` |