| @@ -100,12 +100,8 @@ | ||
| 100 | 100 | return $data; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | private function migrate_data( array &$data, string $meta_key ): void { |
| 104 | - if ( ! Migrations_Orchestrator::is_active() ) { | |
| 105 | - return; | |
| 106 | - } | |
| 107 | - | |
| 108 | 104 | $post_id = $this->post->ID; |
| 109 | 105 | |
| 110 | 106 | Migrations_Orchestrator::make()->migrate( |
| 111 | 107 | $data, |
| @@ -273,9 +269,13 @@ | ||
| 273 | 269 | |
| 274 | 270 | return false !== $result; |
| 275 | 271 | } |
| 276 | 272 | |
| 277 | - public static function clone_to_other_kit( string $style_id, Kit $source_kit, Kit $target_kit ): ?Global_Class_Post { | |
| 273 | + public function clone( Kit $target_kit ): ?self { | |
| 274 | + return self::clone_to_kit( $this->get_class_id(), $this, $target_kit ); | |
| 275 | + } | |
| 276 | + | |
| 277 | + public static function clone_to_other_kit( string $style_id, Kit $source_kit, Kit $target_kit ): ?self { | |
| 278 | 278 | $source_post = self::find_by_class_id( $style_id, false, $source_kit ); |
| 279 | 279 | |
| 280 | 280 | if ( ! $source_post ) { |
| 281 | 281 | return null; |
| @@ -280,8 +280,12 @@ | ||
| 280 | 280 | if ( ! $source_post ) { |
| 281 | 281 | return null; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | + return self::clone_to_kit( $style_id, $source_post, $target_kit ); | |
| 285 | + } | |
| 286 | + | |
| 287 | + private static function clone_to_kit( string $style_id, self $source_post, Kit $target_kit ): ?self { | |
| 284 | 288 | $new_post_id = wp_insert_post( [ |
| 285 | 289 | 'post_type' => Global_Class_Post_Type::CPT, |
| 286 | 290 | 'post_title' => $source_post->get_label(), |
| 287 | 291 | 'post_status' => 'publish', |