Skip to content

Commit 2907174

Browse files
committed
- Make the fields hookable per code review request
1 parent d3a0409 commit 2907174

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/ManageTokens.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,19 @@ public static function add_user_mutation_input_fields() {
159159
],
160160
];
161161

162-
register_graphql_fields( 'RegisterUserInput', $fields );
163-
register_graphql_fields( 'CreateUserInput', $fields );
164-
register_graphql_fields( 'UpdateUserInput', $fields );
162+
163+
$mutations_to_add_fields_to = apply_filters('graphql_jwt_auth_add_user_mutation_input_fields', [
164+
'RegisterUserInput',
165+
'CreateUserInput',
166+
'UpdateUserInput',
167+
] );
168+
169+
if ( ! empty( $mutations_to_add_fields_to ) && is_array( $mutations_to_add_fields_to ) ) {
170+
foreach ( $mutations_to_add_fields_to as $mutation ) {
171+
register_graphql_fields( $mutation, $fields );
172+
}
173+
}
174+
165175
}
166176

167177
/**

0 commit comments

Comments
 (0)