Changeset 56793
- Timestamp:
- 10/06/2023 02:04:22 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update-core.php
r56727 r56793 868 868 'wp-includes/wlwmanifest.xml', 869 869 'wp-includes/random_compat', 870 // 6.4 871 'wp-includes/navigation-fallback.php', 870 872 ); 871 873 -
trunk/src/wp-includes/class-wp-navigation-fallback.php
r56559 r56793 19 19 20 20 /** 21 * Updates the wp_navigation custom post type schema, in order to expose 22 * additional fields in the embeddable links of WP_REST_Navigation_Fallback_Controller. 23 * 24 * The Navigation Fallback endpoint may embed the full Navigation Menu object 25 * into the response as the `self` link. By default, the Posts Controller 26 * will only expose a limited subset of fields but the editor requires 27 * additional fields to be available in order to utilize the menu. 28 * 29 * Used with the `rest_wp_navigation_item_schema` hook. 30 * 31 * @since 6.4.0 32 * 33 * @param array $schema The schema for the `wp_navigation` post. 34 * @return array The modified schema. 35 */ 36 public static function update_wp_navigation_post_schema( $schema ) { 37 // Expose top level fields. 38 $schema['properties']['status']['context'] = array_merge( $schema['properties']['status']['context'], array( 'embed' ) ); 39 $schema['properties']['content']['context'] = array_merge( $schema['properties']['content']['context'], array( 'embed' ) ); 40 41 /* 42 * Exposes sub properties of content field. 43 * These sub properties aren't exposed by the posts controller by default, 44 * for requests where context is `embed`. 45 * 46 * @see WP_REST_Posts_Controller::get_item_schema() 47 */ 48 $schema['properties']['content']['properties']['raw']['context'] = array_merge( $schema['properties']['content']['properties']['raw']['context'], array( 'embed' ) ); 49 $schema['properties']['content']['properties']['rendered']['context'] = array_merge( $schema['properties']['content']['properties']['rendered']['context'], array( 'embed' ) ); 50 $schema['properties']['content']['properties']['block_version']['context'] = array_merge( $schema['properties']['content']['properties']['block_version']['context'], array( 'embed' ) ); 51 52 /* 53 * Exposes sub properties of title field. 54 * These sub properties aren't exposed by the posts controller by default, 55 * for requests where context is `embed`. 56 * 57 * @see WP_REST_Posts_Controller::get_item_schema() 58 */ 59 $schema['properties']['title']['properties']['raw']['context'] = array_merge( $schema['properties']['title']['properties']['raw']['context'], array( 'embed' ) ); 60 61 return $schema; 62 } 63 64 /** 21 65 * Gets (and/or creates) an appropriate fallback Navigation Menu. 22 66 * … … 26 70 */ 27 71 public static function get_fallback() { 28 29 72 /** 30 73 * Filters whether or not a fallback should be created. -
trunk/src/wp-includes/default-filters.php
r56757 r56793 712 712 add_action( 'wp_loaded', '_add_template_loader_filters' ); 713 713 714 // wp_navigation post type. 715 add_filter( 'rest_wp_navigation_item_schema', array( 'WP_Navigation_Fallback', 'update_wp_navigation_post_schema' ) ); 716 714 717 // Fluid typography. 715 718 add_filter( 'render_block', 'wp_render_typography_support', 10, 2 ); -
trunk/src/wp-settings.php
r56614 r56793 355 355 require ABSPATH . WPINC . '/block-supports/typography.php'; 356 356 require ABSPATH . WPINC . '/block-supports/settings.php'; 357 require ABSPATH . WPINC . '/navigation-fallback.php';358 357 require ABSPATH . WPINC . '/style-engine.php'; 359 358 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php'; -
trunk/tests/phpunit/tests/rest-api/rest-navigation-fallback-controller.php
r56548 r56793 153 153 * @ticket 58557 154 154 * 155 * @covers ::wp_add_fields_to_navigation_fallback_embedded_links155 * @covers WP_Navigation_Fallback::update_wp_navigation_post_schema 156 156 * 157 157 * @since 6.3.0 Added Navigation Fallbacks endpoint.
Note: See TracChangeset
for help on using the changeset viewer.