|
10 | 10 | * |
11 | 11 | * Breaking changes to this class will not be considered a semver breaking change as there's no |
12 | 12 | * expectation that users will be calling these functions directly or extending this class. |
13 | | - * |
| 13 | + * |
14 | 14 | * @internal |
15 | 15 | */ |
16 | 16 | class AdminNotices { |
@@ -113,48 +113,48 @@ public function add_admin_notice( string $slug, array $config ): array { |
113 | 113 | /** |
114 | 114 | * Pass the notice through a filter before registering it |
115 | 115 | * |
116 | | - * @param array<string,mixed> $config The config of the admin notice |
117 | | - * @param string $slug The slug identifying the admin notice |
| 116 | + * @param array<string,mixed> $config The config of the admin notice |
| 117 | + * @param string $slug The slug identifying the admin notice |
118 | 118 | */ |
119 | 119 | $filtered_notice = apply_filters( 'graphql_add_admin_notice', $config, $slug ); |
120 | 120 |
|
121 | 121 | // If not a valid config, bail early. |
122 | 122 | if ( ! $this->is_valid_config( $config ) ) { |
123 | 123 | return []; |
124 | 124 | } |
125 | | - |
| 125 | + |
126 | 126 | $this->admin_notices[ $slug ] = $filtered_notice; |
127 | 127 | return $this->admin_notices[ $slug ]; |
128 | 128 | } |
129 | 129 |
|
130 | 130 | /** |
131 | 131 | * Throw an error if the config is not valid. |
132 | 132 | * |
133 | | - * @since @TODO |
| 133 | + * @since v1.21.0 |
134 | 134 | * |
135 | 135 | * @param array<string,mixed> $config The config of the admin notice |
136 | 136 | */ |
137 | 137 | public function is_valid_config( array $config ): bool { |
138 | 138 | if ( empty( $config['message'] ) ) { |
139 | | - _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config message is required', 'wp-graphql' ), '@TODO' ); |
| 139 | + _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config message is required', 'wp-graphql' ), '1.21.0' ); |
140 | 140 | return false; |
141 | 141 | } |
142 | 142 |
|
143 | 143 | if ( isset( $config['conditions'] ) && ! is_callable( $config['conditions'] ) ) { |
144 | | - _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config conditions should be callable', 'wp-graphql' ), '@TODO' ); |
| 144 | + _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config conditions should be callable', 'wp-graphql' ), '1.21.0' ); |
145 | 145 | return false; |
146 | 146 | } |
147 | 147 |
|
148 | 148 | if ( isset( $config['type'] ) && ! in_array( $config['type'], [ 'error', 'warning', 'success', 'info' ], true ) ) { |
149 | | - _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config type should be one of the following: error | warning | success | info', 'wp-graphql' ), '@TODO' ); |
| 149 | + _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'Config type should be one of the following: error | warning | success | info', 'wp-graphql' ), '1.21.0' ); |
150 | 150 | return false; |
151 | 151 | } |
152 | 152 |
|
153 | 153 | if ( isset( $config['is_dismissable'] ) && ! is_bool( $config['is_dismissable'] ) ) { |
154 | | - _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'is_dismissable should be a boolean', 'wp-graphql' ), '@TODO' ); |
| 154 | + _doing_it_wrong( 'register_graphql_admin_notice', esc_html__( 'is_dismissable should be a boolean', 'wp-graphql' ), '1.21.0' ); |
155 | 155 | return false; |
156 | 156 | } |
157 | | - |
| 157 | + |
158 | 158 | return true; |
159 | 159 | } |
160 | 160 |
|
|
0 commit comments