← All changes
|
lib/compat/wordpress-7.1/class-gutenberg-view-config-data.php
+9
-7
23.7.0
→
trunk
View file →
| @@ -119,11 +119,11 @@ | ||
| 119 | 119 | /** |
| 120 | 120 | * Applies the entity view configuration filter and returns the result. |
| 121 | 121 | * |
| 122 | 122 | * Exposes the container through the dynamic |
| 123 | - * `get_entity_view_config_{$kind}_{$name}` filter so that core and third | |
| 124 | - * parties can provide the configuration for a specific entity, then | |
| 125 | - * reconciles the filtered container back into a plain configuration array, | |
| 123 | + * `get_entity_view_config_{$kind}_{$name}` filter (with the dynamic portions | |
| 124 | + * lowercased), so that core and third parties can provide the configuration for a specific entity, | |
| 125 | + * then reconciles the filtered container back into a plain configuration array, | |
| 126 | 126 | * limited to the documented configuration keys. |
| 127 | 127 | * |
| 128 | 128 | * @since 7.1.0 |
| 129 | 129 | * |
| @@ -135,9 +135,11 @@ | ||
| 135 | 135 | /** |
| 136 | 136 | * Filters the view configuration for a given entity. |
| 137 | 137 | * |
| 138 | 138 | * The dynamic portions of the hook name, `$kind` and `$name`, refer to the |
| 139 | - * entity kind (e.g. `postType`) and the entity name (e.g. `page`). | |
| 139 | + * entity kind (e.g. `postType`) and the entity name (e.g. `page`), | |
| 140 | + * lowercased — so the `postType`/`page` entity maps to the | |
| 141 | + * `get_entity_view_config_posttype_page` hook. | |
| 140 | 142 | * |
| 141 | 143 | * Callbacks receive a Gutenberg_View_Config_Data object and change the |
| 142 | 144 | * configuration through its methods. Each write method takes the schema |
| 143 | 145 | * version the change was authored against as its second argument, |
| @@ -179,9 +181,9 @@ | ||
| 179 | 181 | * @type string $name The entity name. |
| 180 | 182 | * } |
| 181 | 183 | */ |
| 182 | 184 | apply_filters( |
| 183 | - "get_entity_view_config_{$kind}_{$name}", | |
| 185 | + gutenberg_get_entity_view_config_hook_name( $kind, $name ), | |
| 184 | 186 | $this, |
| 185 | 187 | array( |
| 186 | 188 | 'kind' => $kind, |
| 187 | 189 | 'name' => $name, |
| @@ -349,15 +351,15 @@ | ||
| 349 | 351 | * For example, given this patch: |
| 350 | 352 | * |
| 351 | 353 | * ```php |
| 352 | 354 | * array( |
| 353 | - * 'default_view' => array( 'search' => 'new search', 'fields' => array( 'newField' ) ), | |
| 355 | + * 'default_view' => array( 'titleField' => 'newTitleField', 'fields' => array( 'newField' ) ), | |
| 354 | 356 | * 'default_layouts' => array( 'grid' => array( 'layout' => array( 'badgeFields' => array( 'newField' ) ) ) ), |
| 355 | 357 | * 'view_list' => array( array( 'slug' => 'table', 'title' => 'New title' ) ), |
| 356 | 358 | * ) |
| 357 | 359 | * ``` |
| 358 | 360 | * |
| 359 | - * - default_view will be updated so the search string is 'new search' and the newField is appended to the list of fields. | |
| 361 | + * - default_view will be updated so the titleField is 'newTitleField' and the newField is appended to the list of fields. | |
| 360 | 362 | * - default_layouts will be updated so that newField is appended to the badgeFields. |
| 361 | 363 | * - view_list will be updated so that the view with slug 'table' has its title changed to 'New title'. |
| 362 | 364 | * |
| 363 | 365 | * A patch value only merges into a current value of the same shape: an |