Skip to content

Commit 28f0952

Browse files
authored
Merge pull request #3027 from wp-graphql/acf-deprecation-notice
feat: Add Admin Notice for WPGraphQL for ACF
2 parents 121a691 + e6cd74a commit 28f0952

File tree

5 files changed

+813
-234
lines changed

5 files changed

+813
-234
lines changed

access-functions.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ static function ( \WPGraphQL\Admin\Settings\SettingsRegistry $registry ) use ( $
735735
*
736736
* @param mixed|string|mixed[] $message The debug message
737737
* @param array<string,mixed> $config The debug config. Should be an associative array of keys and values.
738-
* $config['type'] will set the "type" of the log, default type is GRAPHQL_DEBUG.
738+
* $config['type'] will set the "type" of the log, default type is GRAPHQL_DEBUG.
739739
* Other fields added to $config will be merged into the debug entry.
740740
*
741741
* @return void
@@ -819,7 +819,7 @@ function get_graphql_setting( string $option_name, $default_value = '', $section
819819

820820
/**
821821
* Filter the section fields
822-
822+
823823
* @param array<string,mixed> $section_fields The values of the fields stored for the section
824824
* @param string $section_name The name of the section
825825
* @param mixed $default_value The default value for the option being retrieved
@@ -953,3 +953,16 @@ function str_ends_with( string $haystack, string $needle ): bool {
953953
return $needle_length <= strlen( $haystack ) && 0 === substr_compare( $haystack, $needle, -$needle_length );
954954
}
955955
}
956+
957+
/**
958+
* @param string $slug A unique slug to identify the admin notice by
959+
* @param array<mixed> $config The config for the admin notice. Determines visibility, context, etc.
960+
*/
961+
function register_graphql_admin_notice( string $slug, array $config ): void {
962+
add_action(
963+
'graphql_admin_notices_init',
964+
static function ( \WPGraphQL\Admin\AdminNotices $admin_notices ) use ( $slug, $config ) {
965+
$admin_notices->add_admin_notice( $slug, $config );
966+
}
967+
);
968+
}

0 commit comments

Comments
 (0)