@@ -29,7 +29,6 @@ public function init(): void {
2929 // this is a polyfill for tests to pass
3030 add_filter ( 'acf/post_type_args ' , [ $ this , 'add_cpt_registration_fields ' ], 10 , 2 );
3131
32-
3332 // Add tha GraphQL Tab to the ACF Post Type registration screen
3433 add_filter ( 'acf/post_type/additional_settings_tabs ' , [ $ this , 'add_tabs ' ] );
3534
@@ -138,11 +137,13 @@ public function render_settings_tab( array $acf_post_type ): void {
138137 public function add_cpt_registration_fields ( array $ args , array $ post_type ): array {
139138
140139 // respect the show_in_graphql value. If not set, use the value of $args['public'] to determine if the post type should be shown in graphql
141- $ args ['show_in_graphql ' ] = isset ( $ args ['show_in_graphql ' ] ) ? (bool ) $ args ['show_in_graphql ' ] : true === $ args ['public ' ];
140+ $ args ['show_in_graphql ' ] = isset ( $ post_type ['show_in_graphql ' ] ) ? (bool ) $ post_type ['show_in_graphql ' ] : true === $ args ['public ' ];
142141
143142 $ graphql_single_name = '' ;
144143
145- if ( isset ( $ args ['graphql_single_name ' ] ) ) {
144+ if ( isset ( $ post_type ['graphql_single_name ' ] ) ) {
145+ $ graphql_single_name = $ post_type ['graphql_single_name ' ];
146+ } elseif ( isset ( $ args ['graphql_single_name ' ] ) ) {
146147 $ graphql_single_name = $ args ['graphql_single_name ' ];
147148 } elseif ( isset ( $ args ['labels ' ]['singular_name ' ] ) ) {
148149 $ graphql_single_name = Utils::format_field_name ( $ args ['labels ' ]['singular_name ' ], true );
@@ -153,7 +154,9 @@ public function add_cpt_registration_fields( array $args, array $post_type ): ar
153154
154155 $ graphql_plural_name = '' ;
155156
156- if ( isset ( $ args ['graphql_plural_name ' ] ) ) {
157+ if ( isset ( $ post_type ['graphql_plural_name ' ] ) ) {
158+ $ graphql_plural_name = $ post_type ['graphql_plural_name ' ];
159+ } elseif ( isset ( $ args ['graphql_plural_name ' ] ) ) {
157160 $ graphql_plural_name = $ args ['graphql_plural_name ' ];
158161 } elseif ( isset ( $ args ['labels ' ]['name ' ] ) ) {
159162 $ graphql_plural_name = Utils::format_field_name ( $ args ['labels ' ]['name ' ], true );
0 commit comments