Skip to content

Commit 27b02ac

Browse files
committed
Added callbacks to descriptions.
1 parent 56b2c95 commit 27b02ac

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

includes/Blocks/Block.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private function register_block_attributes_as_fields(): void {
125125
// @TODO - Remove when WPGraphQL min version is 2.3.0
126126
WPGraphQLRegisterConfig::resolve_graphql_config(
127127
[
128-
'description' => sprintf(
128+
'description' => fn () => sprintf(
129129
// translators: %s is the block type name.
130130
__( 'Attributes of the %s Block Type', 'wp-graphql-content-blocks' ),
131131
$this->type_name
@@ -142,7 +142,7 @@ private function register_block_attributes_as_fields(): void {
142142
WPGraphQLRegisterConfig::resolve_graphql_config(
143143
[
144144
'type' => $block_attribute_type_name,
145-
'description' => sprintf(
145+
'description' => fn () => sprintf(
146146
// translators: %s is the block type name.
147147
__( 'Attributes of the %s Block Type', 'wp-graphql-content-blocks' ),
148148
$this->type_name
@@ -306,7 +306,7 @@ private function register_inner_object_type( string $name, array $config, string
306306
WPGraphQLRegisterConfig::resolve_graphql_config(
307307
[
308308
'fields' => $fields,
309-
'description' => sprintf(
309+
'description' => static fn () => sprintf(
310310
// translators: %1$s is the attribute name, %2$s is the block attributes field.
311311
__( 'The "%1$s" field on the "%2$s" block attribute field', 'wp-graphql-content-blocks' ),
312312
$type,
@@ -412,23 +412,23 @@ private function normalize_attribute_value( $value, $type ) {
412412
private function register_type(): void {
413413
register_graphql_object_type(
414414
$this->type_name,
415-
// @TODO - Remove when WPGraphQL min version is 2.3.0
416-
WPGraphQLRegisterConfig::resolve_graphql_config(
417-
[
418-
'description' => __( 'A block used for editing the site', 'wp-graphql-content-blocks' ),
419-
'interfaces' => $this->get_block_interfaces(),
420-
'eagerlyLoadType' => true,
421-
'fields' => [
422-
'name' => [
415+
[
416+
'description' => __( 'A block used for editing the site', 'wp-graphql-content-blocks' ),
417+
'interfaces' => $this->get_block_interfaces(),
418+
'eagerlyLoadType' => true,
419+
'fields' => [
420+
// @TODO - Remove when WPGraphQL min version is 2.3.0
421+
'name' => WPGraphQLRegisterConfig::resolve_graphql_config(
422+
[
423423
'type' => 'String',
424-
'description' => __( 'The name of the block', 'wp-graphql-content-blocks' ),
424+
'description' => static fn () => __( 'The name of the block', 'wp-graphql-content-blocks' ),
425425
'resolve' => static function ( $block ) {
426426
return isset( $block['blockName'] ) ? (string) $block['blockName'] : null;
427427
},
428-
],
429-
],
430-
]
431-
)
428+
]
429+
),
430+
],
431+
]
432432
);
433433
}
434434

includes/Blocks/CoreImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct( WP_Block_Type $block, Registry $block_registry ) {
5252
WPGraphQLRegisterConfig::resolve_graphql_config(
5353
[
5454
'type' => 'MediaDetails',
55-
'description' => sprintf(
55+
'description' => fn () => sprintf(
5656
// translators: %s is the block type name.
5757
__( 'Media Details of the %s Block Type', 'wp-graphql-content-blocks' ),
5858
$this->type_name

includes/Blocks/CorePostTerms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ private function register_fields(): void {
3939
'prefix' => WPGraphQLRegisterConfig::resolve_graphql_config(
4040
[
4141
'type' => 'String',
42-
'description' => __( 'Prefix to display before the post terms', 'wp-graphql-content-blocks' ),
42+
'description' => static fn () => __( 'Prefix to display before the post terms', 'wp-graphql-content-blocks' ),
4343
'resolve' => static fn ( $block ) => isset( $block['attrs']['prefix'] ) ? (string) $block['attrs']['prefix'] : null,
4444
],
4545
),
4646
// @TODO - Remove when WPGraphQL min version is 2.3.0
4747
'suffix' => WPGraphQLRegisterConfig::resolve_graphql_config(
4848
[
4949
'type' => 'String',
50-
'description' => __( 'Suffix to display after the post terms', 'wp-graphql-content-blocks' ),
50+
'description' => static fn () => __( 'Suffix to display after the post terms', 'wp-graphql-content-blocks' ),
5151
'resolve' => static fn ( $block ) => isset( $block['attrs']['suffix'] ) ? (string) $block['attrs']['suffix'] : null,
5252
],
5353
),

includes/Field/BlockSupports/Anchor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function register(): void {
2424
// @TODO - Remove when WPGraphQL min version is 2.3.0
2525
WPGraphQLRegisterConfig::resolve_graphql_config(
2626
[
27-
'description' => __( 'Block that supports Anchor field', 'wp-graphql-content-blocks' ),
27+
'description' => static fn () => __( 'Block that supports Anchor field', 'wp-graphql-content-blocks' ),
2828
'fields' => [
2929
'anchor' => [
3030
'type' => 'string',

includes/Type/InterfaceType/EditorBlockInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function register_type(): void {
4646
// @TODO - Remove when WPGraphQL min version is 2.3.0
4747
WPGraphQLRegisterConfig::resolve_graphql_config(
4848
[
49-
'description' => __( 'Node that has content blocks associated with it', 'wp-graphql-content-blocks' ),
49+
'description' => static fn () => __( 'Node that has content blocks associated with it', 'wp-graphql-content-blocks' ),
5050
'eagerlyLoadType' => true,
5151
'fields' => [
5252
'editorBlocks' => [
@@ -74,7 +74,7 @@ public static function register_type(): void {
7474
'EditorBlock',
7575
[
7676
'eagerlyLoadType' => true,
77-
'description' => __( 'Blocks that can be edited to create content and layouts', 'wp-graphql-content-blocks' ),
77+
'description' => static fn () => __( 'Blocks that can be edited to create content and layouts', 'wp-graphql-content-blocks' ),
7878
'fields' => [
7979
// @TODO - Remove when WPGraphQL min version is 2.3.0
8080
'clientId' => WPGraphQLRegisterConfig::resolve_graphql_config(

includes/Type/Scalar/Scalar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function init(): void {
2222
// @TODO - Remove when WPGraphQL min version is 2.3.0
2323
WPGraphQLRegisterConfig::resolve_graphql_config(
2424
[
25-
'description' => __( 'Generic Object Scalar Type', 'wp-graphql-content-blocks' ),
25+
'description' => fn() => __( 'Generic Object Scalar Type', 'wp-graphql-content-blocks' ),
2626
'serialize' => static function ( $value ) {
2727
return wp_json_encode( $value );
2828
},
@@ -34,7 +34,7 @@ public function init(): void {
3434
// @TODO - Remove when WPGraphQL min version is 2.3.0
3535
WPGraphQLRegisterConfig::resolve_graphql_config(
3636
[
37-
'description' => __( 'Generic Array Scalar Type', 'wp-graphql-content-blocks' ),
37+
'description' => fn() => __( 'Generic Array Scalar Type', 'wp-graphql-content-blocks' ),
3838
'serialize' => static function ( $value ) {
3939
return wp_json_encode( $value );
4040
},

0 commit comments

Comments
 (0)