Skip to content

Commit

Permalink
Reusable Blocks: Rename the post type
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 13, 2017
1 parent 5627739 commit 81566fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/class-wp-rest-reusable-blocks-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function get_items_permissions_check( $request ) {
*/
public function get_items( $request ) {
$reusable_blocks = get_posts( array(
'post_type' => 'gb_reusable_block',
'post_type' => 'wp_block',
) );

$collection = array();
Expand Down Expand Up @@ -219,7 +219,7 @@ protected function prepare_item_for_database( $request ) {
$prepared_reusable_block->ID = $existing_reusable_block->ID;
}

$prepared_reusable_block->post_type = 'gb_reusable_block';
$prepared_reusable_block->post_type = 'wp_block';
$prepared_reusable_block->post_status = 'publish';

// ID. We already validated this in self::update_item().
Expand Down Expand Up @@ -327,7 +327,7 @@ public function get_item_schema() {
*/
private function get_reusable_block( $uuid ) {
$reusable_blocks = get_posts( array(
'post_type' => 'gb_reusable_block',
'post_type' => 'wp_block',
'name' => $uuid,
) );

Expand Down
2 changes: 1 addition & 1 deletion lib/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function gutenberg_add_gutenberg_post_state( $post_states, $post ) {
* @since 0.10.0
*/
function gutenberg_register_post_types() {
register_post_type( 'gb_reusable_block', array(
register_post_type( 'wp_block', array(
'public' => false,
) );
}
Expand Down
2 changes: 1 addition & 1 deletion phpunit/class-rest-reusable-blocks-controller-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class REST_Reusable_Blocks_Controller_Test extends WP_Test_REST_Controller_Testc
*/
public static function wpSetUpBeforeClass( $factory ) {
self::$reusable_block_post_id = wp_insert_post( array(
'post_type' => 'gb_reusable_block',
'post_type' => 'wp_block',
'post_status' => 'publish',
'post_name' => '2d66a5c5-776c-43b1-98c7-49521cef8ea6',
'post_title' => 'My cool block',
Expand Down

0 comments on commit 81566fd

Please sign in to comment.