Changeset 56793 for trunk/src/wp-includes/class-wp-navigation-fallback.php
- Timestamp:
- 10/06/2023 02:04:22 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.
Note: See TracChangeset
for help on using the changeset viewer.