← All changes
|
src/rest-api/settings/class-endpoint-editor-sidebar-settings.php
+41
-0
3.24.0
→
3.24.2
View file →
| @@ -174,8 +174,49 @@ | ||
| 174 | 174 | ); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | + * Returns the composite keys of the settings that inherit their default. | |
| 179 | + * | |
| 180 | + * These are the settings whose default the plugin's settings page makes | |
| 181 | + * configurable. | |
| 182 | + * | |
| 183 | + * @since 3.24.1 | |
| 184 | + * | |
| 185 | + * @return array<string> The composite keys. | |
| 186 | + */ | |
| 187 | + protected function get_inheritable_keys(): array { | |
| 188 | + return array( | |
| 189 | + 'ExcerptSuggestions.Length', | |
| 190 | + 'ExcerptSuggestions.Persona', | |
| 191 | + 'ExcerptSuggestions.Tone', | |
| 192 | + 'TitleSuggestions.Persona', | |
| 193 | + 'TitleSuggestions.Tone', | |
| 194 | + ); | |
| 195 | + } | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * Returns the defaults that the inheritable settings had before 3.24.0 made | |
| 199 | + * them configurable. | |
| 200 | + * | |
| 201 | + * Spelled out rather than taken from Suggestion_Defaults, whose constants | |
| 202 | + * describe the present rather than the past. `Length` is absent, as it did | |
| 203 | + * not exist before it became configurable. | |
| 204 | + * | |
| 205 | + * @since 3.24.1 | |
| 206 | + * | |
| 207 | + * @return array<string, mixed> The defaults, as composite key => value pairs. | |
| 208 | + */ | |
| 209 | + protected function get_legacy_defaults(): array { | |
| 210 | + return array( | |
| 211 | + 'ExcerptSuggestions.Persona' => 'journalist', | |
| 212 | + 'ExcerptSuggestions.Tone' => 'neutral', | |
| 213 | + 'TitleSuggestions.Persona' => 'journalist', | |
| 214 | + 'TitleSuggestions.Tone' => 'neutral', | |
| 215 | + ); | |
| 216 | + } | |
| 217 | + | |
| 218 | + /** | |
| 178 | 219 | * Sanitizes the passed subvalue. |
| 179 | 220 | * |
| 180 | 221 | * Extends the parent implementation with a range check for the desired |
| 181 | 222 | * excerpt length, which the enumerated valid values cannot express. |