fonts-api
2 years ago
interactivity-api
2 years ago
block-editor-settings-mobile.php
2 years ago
block-editor-settings.php
2 years ago
blocks.php
2 years ago
class-gutenberg-rest-global-styles-revisions-controller.php
2 years ago
class-wp-classic-to-block-menu-converter.php
2 years ago
class-wp-navigation-fallback-gutenberg.php
2 years ago
class-wp-rest-block-editor-settings-controller.php
2 years ago
class-wp-rest-customizer-nonces.php
2 years ago
class-wp-rest-navigation-fallback-controller.php
2 years ago
editor-settings.php
2 years ago
kses.php
2 years ago
l10n.php
2 years ago
navigation-fallback.php
2 years ago
navigation-theme-opt-in.php
2 years ago
rest-api.php
2 years ago
navigation-fallback.php
40 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Navigation Fallback |
| 4 | * |
| 5 | * Functions required for managing Navigation fallbacks behavior. |
| 6 | * |
| 7 | * @package Gutenberg |
| 8 | * @since 6.3.0 |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * Expose additional fields in the embeddable links of the |
| 13 | * Navigation Fallback REST endpoint. |
| 14 | * |
| 15 | * The endpoint may embed the full Navigation Menu object into the |
| 16 | * response as the `self` link. By default the Posts Controller |
| 17 | * will only exposes a limited subset of fields but the editor requires |
| 18 | * additional fields to be available in order to utilise the menu. |
| 19 | * |
| 20 | * @param array $schema the schema for the `wp_navigation` post. |
| 21 | * @return array the modified schema. |
| 22 | */ |
| 23 | function gutenberg_add_fields_to_navigation_fallback_embeded_links( $schema ) { |
| 24 | // Expose top level fields. |
| 25 | $schema['properties']['status']['context'] = array_merge( $schema['properties']['status']['context'], array( 'embed' ) ); |
| 26 | $schema['properties']['content']['context'] = array_merge( $schema['properties']['content']['context'], array( 'embed' ) ); |
| 27 | |
| 28 | // Expose sub properties of content field. |
| 29 | $schema['properties']['content']['properties']['raw']['context'] = array_merge( $schema['properties']['content']['properties']['raw']['context'], array( 'embed' ) ); |
| 30 | $schema['properties']['content']['properties']['rendered']['context'] = array_merge( $schema['properties']['content']['properties']['rendered']['context'], array( 'embed' ) ); |
| 31 | $schema['properties']['content']['properties']['block_version']['context'] = array_merge( $schema['properties']['content']['properties']['block_version']['context'], array( 'embed' ) ); |
| 32 | |
| 33 | return $schema; |
| 34 | } |
| 35 | |
| 36 | add_filter( |
| 37 | 'rest_wp_navigation_item_schema', |
| 38 | 'gutenberg_add_fields_to_navigation_fallback_embeded_links' |
| 39 | ); |
| 40 |