Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move WP_REST_Block_Navigation_Areas_Controller from Gutenberg to Core. #36374

Merged
merged 3 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/class-wp-rest-block-navigation-areas-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WP_REST_Block_Navigation_Areas_Controller extends WP_REST_Controller {
* Constructor.
*/
public function __construct() {
$this->namespace = '__experimental';
$this->namespace = 'wp/v2';
$this->rest_base = 'block-navigation-areas';
}

Expand All @@ -37,7 +37,8 @@ public function register_routes() {
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => $this->get_collection_params(),
),
'schema' => array( $this, 'get_public_item_schema' ),
'schema' => array( $this, 'get_public_item_schema' ),
'allow_batch' => array( 'v1' => true ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are now following this pattern.

WordPress/wordpress-develop@ecf1d6a

So this should be

'allow_batch' => $this->allow_batch,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know.
This task is already merged, but I will be using 'allow_batch' => $this->allow_batch from now on.

)
);

Expand Down
2 changes: 1 addition & 1 deletion lib/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function gutenberg_get_navigation_areas_paths_to_preload() {
$areas = get_option( 'fse_navigation_areas', array() );
$active_areas = array_intersect_key( $areas, gutenberg_get_navigation_areas() );
$paths = array(
'/__experimental/block-navigation-areas?context=edit',
'/wp/v2/block-navigation-areas?context=edit',
);
foreach ( $active_areas as $post_id ) {
if ( 0 !== $post_id ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-data/src/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const defaultEntities = [
{
name: 'navigationArea',
kind: 'root',
baseURL: '/__experimental/block-navigation-areas',
baseURL: '/wp/v2/block-navigation-areas',
baseURLParams: { context: 'edit' },
plural: 'navigationAreas',
label: __( 'Navigation Area' ),
Expand Down
4 changes: 2 additions & 2 deletions packages/core-data/src/test/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe( 'saveEditedEntityRecord', () => {
{
kind: 'root',
name: 'navigationArea',
baseURL: '/__experimental/block-navigation-areas',
baseURL: '/wp/v2/block-navigation-areas',
},
];
const select = {
Expand Down Expand Up @@ -160,7 +160,7 @@ describe( 'saveEditedEntityRecord', () => {
{
kind: 'root',
name: 'navigationArea',
baseURL: '/__experimental/block-navigation-areas',
baseURL: '/wp/v2/block-navigation-areas',
key: 'area',
},
];
Expand Down