block_core_navigation_parse_blocks_from_menu_items example

defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN &&
        array_key_exists( '__unstableLocation', $attributes ) &&
        ! array_key_exists( 'ref', $attributes ) &&
        ! empty( block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ) )
    ) {
        $menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] );
        if ( empty( $menu_items ) ) {
            return '';
        }

        $menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items );
        $parsed_blocks           = block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[0]$menu_items_by_parent_id );
        $inner_blocks            = new WP_Block_List( $parsed_blocks$attributes );
    }

    // Load inner blocks from the navigation post.     if ( array_key_exists( 'ref', $attributes ) ) {
        $navigation_post = get_post( $attributes['ref'] );
        if ( ! isset( $navigation_post ) ) {
            return '';
        }

        // Only published posts are valid. If this is changed then a corresponding change
Home | Imprint | This part of the site doesn't use cookies.