Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Load files, use stable namespace, register routes, girl scouting.
* Update to stable namespace.
* Register routes for WP_REST_Block_Pattern_Categories_Controller
* Require class file for WP_REST_Block_Pattern_Categories_Controller
* Update expected route for WP_REST_Block_Patterns_Controller
* Require class file for WP_REST_Block_Patterns_Controller
* Register routes for WP_REST_Block_Patterns_Controller
* Girl scouting annotations and formatting
  • Loading branch information
ironprogrammer authored Apr 7, 2022
commit ceedc0a33b0b336e9465bf6322f4464c28f622c8
2 changes: 1 addition & 1 deletion src/wp-includes/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Registers the core block patterns and categories.
*
* @since 5.5.0
* @private
* @access private
*/
function _register_core_block_patterns_and_categories() {
$should_register_core_patterns = get_theme_support( 'core-block-patterns' );
Expand Down
3 changes: 1 addition & 2 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,8 @@ function do_blocks( $content ) {
* If do_blocks() needs to remove wpautop() from the `the_content` filter, this re-adds it afterwards,
* for subsequent `the_content` usage.
*
* @access private
*
* @since 5.0.0
* @access private
*
* @param string $content The post content running through this filter.
* @return string The unmodified content.
Expand Down
8 changes: 8 additions & 0 deletions src/wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,14 @@ function create_initial_rest_routes() {
$controller = new WP_REST_Pattern_Directory_Controller();
$controller->register_routes();

// Block Patterns.
$controller = new WP_REST_Block_Patterns_Controller();
$controller->register_routes();

// Block Pattern Categories.
$controller = new WP_REST_Block_Pattern_Categories_Controller();
$controller->register_routes();

// Site Health.
$site_health = WP_Site_Health::get_instance();
$controller = new WP_REST_Site_Health_Controller( $site_health );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WP_REST_Block_Pattern_Categories_Controller extends WP_REST_Controller {
* @since 6.0.0
*/
public function __construct() {
$this->namespace = '__experimental';
$this->namespace = 'wp/v2';
$this->rest_base = 'block-patterns/categories';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WP_REST_Block_Patterns_Controller extends WP_REST_Controller {
* @since 6.0.0
*/
public function __construct() {
$this->namespace = '__experimental';
$this->namespace = 'wp/v2';
$this->rest_base = 'block-patterns/patterns';
}

Expand Down
2 changes: 2 additions & 0 deletions src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-patterns-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-application-passwords-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-site-health-controller.php';
require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-sidebars-controller.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Tests_REST_WpRestBlockPatternCategoriesController extends WP_Test_REST_Con
*
* @var string
*/
const REQUEST_ROUTE = '/__experimental/block-patterns/categories';
const REQUEST_ROUTE = '/wp/v2/block-patterns/categories';

/**
* Set up class test fixtures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Tests_REST_WpRestBlockPatternsController extends WP_Test_REST_Controller_T
*
* @var string
*/
const REQUEST_ROUTE = '/__experimental/block-patterns/patterns';
const REQUEST_ROUTE = '/wp/v2/block-patterns/patterns';

/**
* Set up class test fixtures.
Expand Down Expand Up @@ -100,7 +100,6 @@ public function set_up() {
public function test_register_routes() {
$routes = rest_get_server()->get_routes();
$this->assertArrayHasKey( static::REQUEST_ROUTE, $routes );

}

public function test_get_items() {
Expand Down