Make WordPress Core


Ignore:
Timestamp:
11/12/2021 03:53:18 AM (3 years ago)
Author:
noisysocks
Message:

Editor: Add Navigation Area infrastructure

Copies Navigation Area infrastrucutre from lib/navigation.php in Gutenberg. This
allows a Navigation block to be associated with a particular area which persists
when switching theme.

Props antonvlasenko, mamaduka, spacedmonkey.
See #54337.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/site-editor.php

    r52071 r52145  
    6060    '/wp/v2/global-styles/' . $active_global_styles_id,
    6161    '/wp/v2/themes/' . $active_theme . '/global-styles',
     62    '/wp/v2/block-navigation-areas?context=edit',
    6263);
     64
     65$areas        = get_option( 'fse_navigation_areas', array() );
     66$active_areas = array_intersect_key( $areas, get_navigation_areas() );
     67foreach ( $active_areas as $post_id ) {
     68    if ( $post_id ) {
     69        $preload_paths[] = add_query_args( 'context', 'edit', rest_get_route_for_post( $post_id ) );
     70    }
     71}
     72
    6373block_editor_rest_api_preload( $preload_paths, $block_editor_context );
    6474
Note: See TracChangeset for help on using the changeset viewer.