View config: lowercase dynamic filter names - #12809
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| * parties can provide the configuration for a specific entity, then | ||
| * reconciles the filtered container back into a plain configuration array, | ||
| * `get_entity_view_config_{$kind}_{$name}` filter (with the dynamic portions | ||
| * lowercased, so that core and third parties can provide the configuration for a specific entity, |
There was a problem hiding this comment.
Closing parenthesis is missing here.
There was a problem hiding this comment.
Pull request overview
This PR standardizes the dynamic filter hook name used by the Entity View Configuration API by lowercasing the dynamic {kind} and {name} portions, aligning the hook naming with common WordPress/PHP lowercase hook conventions.
Changes:
- Introduces
wp_get_entity_view_config_hook_name()and uses it when applying the dynamic filter so hook names are consistently lowercased. - Updates core hook registrations and provider callback function names to match the new lowercase
posttypeconvention. - Adds/updates PHPUnit coverage to assert the lowercased hook name behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/phpunit/tests/view-config.php | Updates teardown hook cleanup and adds a test asserting the dynamic hook name is lowercased. |
| src/wp-includes/view-config.php | Adds a helper to build the lowercased hook name and renames internal post type helpers to posttype naming. |
| src/wp-includes/default-filters.php | Registers the default view-config providers using the new lowercase get_entity_view_config_posttype_{post_type} hook. |
| src/wp-includes/class-wp-view-config-data.php | Switches the filter application to use wp_get_entity_view_config_hook_name() and updates inline docs accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Exposes the container through the dynamic | ||
| * `get_entity_view_config_{$kind}_{$name}` filter so that core and third | ||
| * parties can provide the configuration for a specific entity, then | ||
| * reconciles the filtered container back into a plain configuration array, | ||
| * `get_entity_view_config_{$kind}_{$name}` filter (with the dynamic portions | ||
| * lowercased), so that core and third parties can provide the configuration for a specific entity, | ||
| * then reconciles the filtered container back into a plain configuration array, | ||
| * limited to the documented configuration keys. |
|
Backported at https://core.trac.wordpress.org/changeset/62970 |
Trac ticket https://core.trac.wordpress.org/ticket/65577
Backports WordPress/gutenberg#81068
Follow-up to #12391
What?
Lowercases the dynamic filter names for view config.
Why?
Lowercase names match PHP practices, feedback.
How?
Make the dynamic filter hook name lowercase.
Testing Instructions
Load the Site Editor screens (Pages, Templates, Patterns&Parts) and verify they still work as before.