Skip to content

Commit fa82a9b

Browse files
Release Plugin (#370)
* Release Plugin * Update CHANGELOG.md --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Theofanis Despoudis <[email protected]>
1 parent bb3631c commit fa82a9b

File tree

5 files changed

+17
-164
lines changed

5 files changed

+17
-164
lines changed

.changeset/six-boats-exercise.md

-5
This file was deleted.

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# WPGraphQL Content Blocks
22

3+
## 4.8.3
4+
5+
### Patch Changes
6+
7+
- bf77481: Updated plugin test suite and readme for WordPress 6.8
8+
- bb3631c: Adds WPGraphQL version compatibility headers and checks
9+
310
## 4.8.2
411

512
### Patch Changes

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@wpengine/wp-graphql-content-blocks",
33
"private": true,
4-
"version": "4.8.2",
4+
"version": "4.8.3",
55
"engines": {
66
"node": ">=16.0.0"
77
},

readme.txt

+7-156
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: blakewpe, chriswiegman, joefusco, matthewguywright, TeresaGobble,
33
Tags: faustjs, faust, headless, decoupled, gutenberg
44
Requires at least: 5.7
55
Tested up to: 6.8
6-
Stable tag: 4.8.2
6+
Stable tag: 4.8.3
77
Requires PHP: 7.4
88
License: GPLv2 or later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -26,6 +26,12 @@ Extends WPGraphQL to support querying (Gutenberg) Blocks as data.
2626

2727
== Changelog ==
2828

29+
= 4.8.3 =
30+
31+
### Patch Changes
32+
33+
- bf77481: Updated plugin test suite and readme for WordPress 6.8
34+
2935
= 4.8.2 =
3036

3137
### Patch Changes
@@ -38,159 +44,4 @@ Extends WPGraphQL to support querying (Gutenberg) Blocks as data.
3844

3945
- 84a65bb: bug: Fixes fatal error when you de-activate WPGraphQL
4046

41-
= 4.8.0 =
42-
43-
### Minor Changes
44-
45-
- 742f18a: # Querying Object-Type Block Attributes in WPGraphQL
46-
47-
## Overview
48-
49-
With this update, you can now query object-type block attributes with each property individually, provided that the **typed structure** is defined in the class `typed_object_attributes` property or through a **WordPress filter**.
50-
51-
## How It Works
52-
53-
The `typed_object_attributes` is a **filterable** array that defines the expected **typed structure** for object-type block attributes.
54-
55-
- The **keys** in `typed_object_attributes` correspond to **object attribute names** in the block.
56-
- Each value is an **associative array**, where:
57-
- The key represents the **property name** inside the object.
58-
- The value defines the **WPGraphQL type** (e.g., `string`, `integer`, `object`, etc.).
59-
- If a block attribute has a specified **typed structure**, only the properties listed within it will be processed.
60-
61-
## Defining Typed Object Attributes
62-
63-
Typed object attributes can be **defined in two ways**:
64-
65-
### 1. In a Child Class (`typed_object_attributes` property)
66-
67-
Developers can extend the `Block` class and specify **typed properties** directly:
68-
69-
```php
70-
class CustomMovieBlock extends Block {
71-
/**
72-
* {@inheritDoc}
73-
*
74-
* @var array<string, array<string, "array"|"boolean"|"number"|"integer"|"object"|"rich-text"|"string">>
75-
*/
76-
protected array $typed_object_attributes = [
77-
'film' => [
78-
'id' => 'integer',
79-
'title' => 'string',
80-
'director' => 'string',
81-
'soundtrack' => 'object',
82-
],
83-
'soundtrack' => [
84-
'title' => 'string',
85-
'artist' => 'string'
86-
],
87-
];
88-
}
89-
```
90-
91-
### 2. Via WordPress Filter
92-
93-
You can also define **typed structures dynamically** using a WordPress filter.
94-
95-
```php
96-
add_filter(
97-
'wpgraphql_content_blocks_object_typing_my-custom-plugin_movie-block',
98-
function () {
99-
return [
100-
'film' => [
101-
'id' => 'integer',
102-
'title' => 'string',
103-
'director' => 'string',
104-
'soundtrack' => 'object',
105-
],
106-
'soundtrack' => [
107-
'title' => 'string',
108-
'artist' => 'string'
109-
],
110-
];
111-
}
112-
);
113-
```
114-
115-
## Filter Naming Convention
116-
117-
To apply custom typing via a filter, use the following format:
118-
119-
```
120-
wpgraphql_content_blocks_object_typing_{block-name}
121-
```
122-
123-
- Replace `/` in the block name with `-`.
124-
- Example:
125-
- **Block name**: `my-custom-plugin/movie-block`
126-
- **Filter name**: `wpgraphql_content_blocks_object_typing_my-custom-plugin_movie-block`
127-
128-
## Example:
129-
130-
### Example `block.json` Definition
131-
132-
If the block has attributes defined as **objects**, like this:
133-
134-
```json
135-
"attributes": {
136-
"film": {
137-
"type": "object",
138-
"default": {
139-
"id": 1,
140-
"title": "The Matrix",
141-
"director": "Director Name"
142-
}
143-
},
144-
"soundtrack": {
145-
"type": "object",
146-
"default": {
147-
"title": "The Matrix Revolutions...",
148-
"artist": "Artist Name"
149-
}
150-
}
151-
}
152-
```
153-
154-
This means:
155-
156-
- The `film` attribute contains `id`, `title`, `director`.
157-
- The `soundtrack` attribute contains `title` and `artist`.
158-
159-
## WPGraphQL Query Example
160-
161-
Once the typed object attributes are **defined**, you can query them **individually** in WPGraphQL.
162-
163-
```graphql
164-
fragment Movie on MyCustomPluginMovieBlock {
165-
attributes {
166-
film {
167-
id
168-
title
169-
director
170-
soundtrack {
171-
title
172-
}
173-
}
174-
soundtrack {
175-
title
176-
artist
177-
}
178-
}
179-
}
180-
181-
query GetAllPostsWhichSupportBlockEditor {
182-
posts {
183-
edges {
184-
node {
185-
editorBlocks {
186-
__typename
187-
name
188-
...Movie
189-
}
190-
}
191-
}
192-
}
193-
}
194-
```
195-
19647
[View the full changelog](https://github.com/wpengine/wp-graphql-content-blocks/blob/main/CHANGELOG.md)

wp-graphql-content-blocks.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
99
* Text Domain: wp-graphql-content-blocks
1010
* Domain Path: /languages
11-
* Version: 4.8.2
11+
* Version: 4.8.3
1212
* Requires PHP: 7.4
1313
* Requires at least: 5.7
1414
* Requires Plugins: wp-graphql
@@ -47,7 +47,7 @@ function wpgraphql_content_blocks_constants(): void {
4747
}
4848

4949
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION' ) ) {
50-
define( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION', '4.8.2' );
50+
define( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION', '4.8.3' );
5151
}
5252

5353
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_URL' ) ) {

0 commit comments

Comments
 (0)