| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Entity Fields API. A field definition is the serializable subset of the DataViews Field API: every property that is plain data (`id`, `type`, `label`, `elements`, `filterBy`, `isValid`, …). Properties that are JavaScript callbacks or components (`render`, `Edit` as a component, `getValue`, `setValue`, `sort`, `isVisible`, `getElements`, …) cannot be declared here. They are provided by a script module registered for the entity along with its fields: its default export maps field ids to the properties of each field that are JavaScript. An entity can have several modules. Each module applies to the fields it was registered with, see {@see wp_get_registered_entity_field_modules()}.
| File Size: | 225 lines (9 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| wp_register_entity_fields( $origin, $kind, $name, $fields, $script_module = null ) X-Ref |
| Registers fields for an entity, see {@see WP_Entity_Fields_Registry::register()}. It only runs on the `wp_entity_fields_api_init` action. return: string[] The ids of the fields registered, in the order of the param: string $origin Who registers the fields: `core`, or param: string $kind The entity kind (e.g. `postType`). param: string $name The entity name (e.g. `page`). param: array[] $fields The list of field definitions, each with an `id`. param: string|null $script_module The id of the script module providing |
| wp_update_entity_fields( $origin, $kind, $name, $fields, $script_module = null ) X-Ref |
| Updates registered fields of an entity, see {@see WP_Entity_Fields_Registry::update()}. It only runs on the `wp_entity_fields_api_init` action. return: string[] The ids of the fields updated, in the order of the param: string $origin Who updates the fields: `core`, or param: string $kind The entity kind (e.g. `postType`). param: string $name The entity name (e.g. `page`). param: array[] $fields The list of partial field definitions, param: string|null $script_module The id of the script module providing |
| wp_unregister_entity_fields( $kind, $name, $ids = null ) X-Ref |
| Unregisters fields of an entity, see {@see WP_Entity_Fields_Registry::unregister()}. It only runs on the `wp_entity_fields_api_init` action. return: array[] The list of the definitions unregistered, in param: string $kind The entity kind (e.g. `postType`). param: string $name The entity name (e.g. `page`). param: string[]|null $ids The ids of the fields to unregister. Default |
| wp_get_registered_entity_fields( $kind, $name ) X-Ref |
| Returns the fields registered for the given entity. return: array[] The list of registered field definitions, in registration param: string $kind The entity kind (e.g. `postType`). param: string $name The entity name (e.g. `page`). |
| wp_get_registered_entity_field_modules( $kind, $name ) X-Ref |
| Returns the script modules registered for the given entity. return: array[] { param: string $kind The entity kind (e.g. `postType`). param: string $name The entity name (e.g. `page`). |
| wp_get_all_registered_entity_field_modules() X-Ref |
| Returns the ids of all script modules registered for any entity. return: array<string, array<string, string[]>> The lists of module ids, |
| _wp_add_entity_field_modules_to_editor_script( $scripts = null ) X-Ref |
| Declares the script modules of the entity fields as dependencies of the editor script, see _wp_add_entity_modules_to_editor_script(). The fields are loaded by the editor package, see packages/editor/src/dataviews/store/private-resolvers.ts in Gutenberg, which means any screen that wants to use this mechanism needs to load the editor script. It is hooked to `admin_footer` without arguments, so the global scripts registry is used. In other scenarios (tests), the scripts are given directly. param: WP_Scripts|null $scripts Optional. The scripts registry. Default null, |
| wp_get_entity_field_collection_fields( $directory ) X-Ref |
| Returns the fields of a field collection, see {@see WP_Entity_Fields_Registry::get_collection_fields()}. return: array<string, array> The fields of the collection, keyed by id, in param: string $directory The directory of the collection. |
| wp_register_entity_field_collection( $directory ) X-Ref |
| Registers the fields of a field collection, see {@see WP_Entity_Fields_Registry::register_collection()} for the format of a collection. Like wp_register_entity_fields(), it only runs on the `wp_entity_fields_api_init` action. return: bool Whether the collection is valid and all of its fields are param: string $directory The directory of the collection. |
| _wp_preload_entity_fields( $paths, $context = null ) X-Ref |
| Preloads the fields of the post types the editors list. The editors read them from the `/wp/v2/entity-fields` route, see `useFields` in packages/editor/src/dataviews/fields-loader/index.ts in Gutenberg. The post editor reads those of the edited post in the post summary of its inspector. The site editor reads those of the edited post, if any, and of the post types of the screen it opens on. A path must match the request of the `getFieldsConfig` core data resolver, see packages/core-data/src/resolvers.js in Gutenberg. return: mixed Filtered preload paths. See _wp_add_entity_preload_paths(). param: mixed $paths REST API paths to preload. param: mixed $context Optional. Block editor context. Default null. |
| Generated : Mon Nov 9 08:20:01 2026 | Cross-referenced by PHPXref |