Skip to content

Commit 4938913

Browse files
committed
- composer fix-cs
- add translators: comments
1 parent d2c28f2 commit 4938913

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/FieldConfig.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ protected function is_supported_field_type(): bool {
136136
public function get_field_description(): string {
137137

138138
$graphql_field_type = $this->get_graphql_field_type();
139-
$field_type_config = ( $graphql_field_type instanceof AcfGraphQLFieldType ) ? $graphql_field_type->get_config() : [];
139+
$field_type_config = ( $graphql_field_type instanceof AcfGraphQLFieldType ) ? $graphql_field_type->get_config() : [];
140140

141141
// Use the explicit graphql_description, if set
142142
if ( ! empty( $this->acf_field['graphql_description'] ) ) {
@@ -157,7 +157,6 @@ public function get_field_description(): string {
157157
}
158158

159159
if ( isset( $field_type_config['graphql_description_after'] ) ) {
160-
161160
if ( is_callable( $field_type_config['graphql_description_after'] ) ) {
162161
$description .= ' ' . call_user_func( $field_type_config['graphql_description_after'], $this );
163162
} else {

src/FieldType/DatePicker.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ public static function register_field_type(): void {
1212
register_graphql_acf_field_type(
1313
'date_picker',
1414
[
15-
'graphql_type' => 'String',
15+
'graphql_type' => 'String',
1616
// Apply a description to be appended to the field description.
1717
// @todo: consider removing when CustomScalar types are supported along with the @specifiedBy directive
18-
'graphql_description_after' => function( FieldConfig $field_config ) {
18+
'graphql_description_after' => static function ( FieldConfig $field_config ) {
1919
$field_type = $field_config->get_acf_field()['type'] ?? null;
2020

21-
return '(' . sprintf( __( 'ACF Fields of the %s type return a date string according to the RFC3339 spec: https://datatracker.ietf.org/doc/html/rfc3339.', 'wp-graphql-acf' ), $field_type ) . ')';
21+
// translators: The $s is the name of the acf field type that is returning a date string according to the RFC3339 spec.
22+
return '(' . sprintf( __( 'ACF Fields of the %s type return a date string according to the RFC3339 spec: https://datatracker.ietf.org/doc/html/rfc3339.', 'wpgraphql-acf' ), $field_type ) . ')';
2223
},
23-
'resolve' => static function ( $root, $args, $context, $info, $field_type, FieldConfig $field_config ) {
24+
'resolve' => static function ( $root, $args, $context, $info, $field_type, FieldConfig $field_config ) {
2425
$value = $field_config->resolve_field( $root, $args, $context, $info );
2526

2627
if ( empty( $value ) ) {

src/FieldType/DateTimePicker.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ public static function register_field_type(): void {
1313
register_graphql_acf_field_type(
1414
'date_time_picker',
1515
[
16-
'graphql_type' => 'String',
16+
'graphql_type' => 'String',
1717
// Apply a description to be appended to the field description.
1818
// @todo: consider removing when CustomScalar types are supported along with the @specifiedBy directive
19-
'graphql_description_after' => function( FieldConfig $field_config ) {
19+
'graphql_description_after' => static function ( FieldConfig $field_config ) {
2020
$field_type = $field_config->get_acf_field()['type'] ?? null;
2121

22-
return '(' . sprintf( __( 'ACF Fields of the %s type return a date string according to the RFC3339 spec: https://datatracker.ietf.org/doc/html/rfc3339.', 'wp-graphql-acf' ), $field_type ) . ')';
22+
// translators: The $s is the name of the acf field type that is returning a date string according to the RFC3339 spec.
23+
return '(' . sprintf( __( 'ACF Fields of the "%s" type return a date string according to the RFC3339 spec: https://datatracker.ietf.org/doc/html/rfc3339.', 'wpgraphql-acf' ), $field_type ) . ')';
2324
},
24-
'resolve' => static function ( $root, $args, $context, $info, $field_type, FieldConfig $field_config ) {
25+
'resolve' => static function ( $root, $args, $context, $info, $field_type, FieldConfig $field_config ) {
2526
$value = $field_config->resolve_field( $root, $args, $context, $info );
2627

2728
if ( empty( $value ) ) {

0 commit comments

Comments
 (0)