Skip to content

View config: lowercase dynamic filter names - #12809

Closed
oandregal wants to merge 2 commits into
WordPress:trunkfrom
oandregal:update/hook-name-to-lowercase
Closed

View config: lowercase dynamic filter names#12809
oandregal wants to merge 2 commits into
WordPress:trunkfrom
oandregal:update/hook-name-to-lowercase

Conversation

@oandregal

Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings August 3, 2026 08:15
@oandregal oandregal self-assigned this Aug 3, 2026
@oandregal
oandregal requested review from ntsekouras and removed request for Copilot August 3, 2026 08:15
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props oandregal, ntsekouras.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@ntsekouras ntsekouras left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

* 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing parenthesis is missing here.

Copilot AI review requested due to automatic review settings August 3, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 posttype convention.
  • 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.

Comment on lines 123 to 127
* 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.
@oandregal

Copy link
Copy Markdown
Member Author

@oandregal oandregal closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants