Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ module.exports = function(grunt) {
src: 'vendor/composer/ca-bundle/res/cacert.pem',
dest: SOURCE_DIR + 'wp-includes/certificates/ca-bundle.crt'
},
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/, core actions).
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/, core actions, core fields).
'gutenberg-php': {
options: {
process: function( content ) {
Expand All @@ -718,6 +718,8 @@ module.exports = function(grunt) {
'pages/**/*.php',
// The actions Core registers through the entity actions API.
'scripts/core-actions/**/*.php',
// The fields Core registers through the entity fields API.
'scripts/core-fields/**/*.php',
],
dest: SOURCE_DIR + 'wp-includes/build/',
} ],
Expand Down
4 changes: 3 additions & 1 deletion src/wp-includes/entity-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* Fields can also be declared as files, grouped in a field collection, which
* a `wp_entity_fields_api_init` callback registers with
* {@see wp_register_entity_field_collection()}. A collection is for a single
* entity.
* entity. WordPress core registers its own fields this way, from
* packages/core-fields: the defaults every post type derives from its
* supports in code, the fields of single post types as collections.
*
* The registered fields are exposed by the `/wp/v2/entity-fields` REST API
* route, see {@see WP_REST_Entity_Fields_Controller}.
Expand Down
3 changes: 3 additions & 0 deletions src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
if ( file_exists( ABSPATH . WPINC . '/build/scripts/core-actions/index.php' ) ) {
require ABSPATH . WPINC . '/build/scripts/core-actions/index.php';
}
if ( file_exists( ABSPATH . WPINC . '/build/scripts/core-fields/index.php' ) ) {
require ABSPATH . WPINC . '/build/scripts/core-fields/index.php';
}
require ABSPATH . WPINC . '/taxonomy.php';
require ABSPATH . WPINC . '/class-wp-taxonomy.php';
require ABSPATH . WPINC . '/class-wp-term.php';
Expand Down
6 changes: 4 additions & 2 deletions tests/phpunit/tests/entity-fields/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ abstract class WP_Entity_Fields_UnitTestCase extends WP_UnitTestCase {
* Sets up each test.
*
* Registers the fixture defaults, see register_default_fields(), at
* priority 0, before the callbacks of the tests, and resets the registry
* so its next read fires `wp_entity_fields_api_init` anew.
* priority 0, before the callbacks of the tests, in place of the fields
* WordPress core registers, and resets the registry so its next read
* fires `wp_entity_fields_api_init` anew.
*/
public function set_up() {
parent::set_up();

remove_action( 'wp_entity_fields_api_init', 'wp_register_core_field_collections', 0 );
add_action( 'wp_entity_fields_api_init', array( static::class, 'register_default_fields' ), 0 );
self::reset_registry();
}
Expand Down
Loading
Loading