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

Reusable Blocks: Rename the post type #3453

Merged
merged 1 commit into from
Nov 13, 2017
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
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