#65516 closed enhancement (fixed)
Register and filter view config for DataViews/DataForm in the server
| Reported by: | oandregal | Owned by: | oandregal |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | General | Version: | trunk |
| Severity: | normal | Keywords: | has-patch has-unit-tests gutenberg-merge |
| Cc: | Focuses: |
Description
We want to introduce the ability to configure the view/form config received by DataViews/DataForm for any given entity. For example, 3rd parties should be able to change what fields are visible in DataViews, or the default layouts.
The whole initiative is tracked in Gutenberg at https://github.com/WordPress/gutenberg/issues/76544
Change History (8)
This ticket was mentioned in PR #11272 on WordPress/wordpress-develop by @oandregal.
8 weeks ago
#1
- Keywords has-unit-tests added
This ticket was mentioned in PR #12288 on WordPress/wordpress-develop by @jorgefilipecosta.
7 weeks ago
#3
## What?
Adds the wp_block form configuration for the View Config API so pattern summaries can expose the DataForm fields used by the editor sidebar.
This is a follow-up to WordPress/wordpress-develop#11272 and backports the PHP portion of WordPress/gutenberg#79452.
## Testing
- git diff --check
- php -l src/wp-includes/view-config.php && php -l tests/phpunit/tests/rest-api/rest-view-config-controller.php
- vendor/bin/phpcs src/wp-includes/view-config.php tests/phpunit/tests/rest-api/rest-view-config-controller.php
- php ./vendor/bin/phpunit --filter test_wp_block_config_includes_pattern_summary_form
@ntsekouras commented on PR #12288:
7 weeks ago
#4
Do we need a new trac ticket or we can re-open the previous one with the initial backport 🤔
@mcsf commented on PR #12288:
7 weeks ago
#5
Do we need a new trac ticket or we can re-open the previous one with the initial backport 🤔
I think it could go either way, but I suggest opening a new ticket linking back to the original one.
@ntsekouras commented on PR #12288:
7 weeks ago
#7
I suggest opening a new ticket linking back to the original one.
I opened a new trac ticket for this PR which will include two PRs from GB (see description)
This ticket was mentioned in PR #12638 on WordPress/wordpress-develop by @oandregal.
3 weeks ago
#8
Trac ticket: https://core.trac.wordpress.org/ticket/65516
## What
Ports the latest iteration of the view configuration API from the Gutenberg update/view-config-api-versioning branch:
## Why
## How
- Rework the
WP_View_Config_Datawrite API aroundmerge(),replace(),set(), andremove(), all operating on patches of top-level keys and taking the schema version the change was authored against. - Make
get_data()private and move filter application into a new apply_filters() method so callbacks cannot read the materialized configuration and become coupled to its shape. - Update the default post type configuration callbacks to use the new single-patch
set()signature. - Adapt and expand the unit tests accordingly.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code, Zed agent
Model(s): Opus, Fabble
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Trac ticket: https://core.trac.wordpress.org/ticket/65516
## What?
Introduces a server-side, filterable API for the DataViews/DataForm configuration of an entity, plus a REST endpoint that exposes it.
wp_get_entity_view_config( $kind, $name )(new src/wp-includes/view-config.php) builds the shared defaults (default view, layouts, view list, form) and runs them through a dynamicget_entity_view_config_{$kind}_{$name}filter so core and plugins can provide per-entity configuration.page,post,wp_block,wp_template_part, andwp_templatepost types as filter callbacks oninit(_wp_get_entity_view_config_post_type_*).WP_REST_View_Config_Controllerexposes the config atGET /wp/v2/view-config?kind=…&name=…, delegating to the API and handling REST concerns (schema,edit_postspermission, empty-object serialization).## Why?
Part of https://github.com/WordPress/gutenberg/issues/76544
## How?
Backports the View Config REST API endpoint from Gutenberg to WordPress Core.
## Testing Instructions
## Use of AI Tools
This backport was prepared with the assistance of Claude Code (Claude Opus 4.8).