← All changes
|
app/modules/import-export/processes/import.php
+16
-0
4.1.2
→
4.3.0-beta3
View file →
| @@ -7,8 +7,10 @@ | ||
| 7 | 7 | use Elementor\App\Modules\ImportExport\Compatibility\Kit_Library; |
| 8 | 8 | use Elementor\App\Modules\ImportExport\Utils; |
| 9 | 9 | use Elementor\Core\Base\Document; |
| 10 | 10 | use Elementor\Core\Kits\Documents\Kit; |
| 11 | +use Elementor\Modules\AtomicWidgets\Utils\Atomic_Prop_Remap; | |
| 12 | +use Elementor\Modules\Components\Module as Components_Module; | |
| 11 | 13 | use Elementor\Plugin; |
| 12 | 14 | |
| 13 | 15 | use Elementor\App\Modules\ImportExport\Runners\Import\Elementor_Content; |
| 14 | 16 | use Elementor\App\Modules\ImportExport\Runners\Import\Import_Runner_Base; |
| @@ -739,8 +741,11 @@ | ||
| 739 | 741 | foreach ( $this->documents_data as $new_id => $data ) { |
| 740 | 742 | $document = Plugin::$instance->documents->get( $new_id ); |
| 741 | 743 | |
| 742 | 744 | if ( isset( $data['elements'] ) ) { |
| 745 | + $data['elements'] = Components_Module::prepare_imported_elements( $data['elements'], $imported_data_replacements['post_ids'] ?? [] ); | |
| 746 | + $data['elements'] = Atomic_Prop_Remap::apply( $data['elements'], $imported_data_replacements ); | |
| 747 | + $this->merge_atomic_prop_remap_warnings( Atomic_Prop_Remap::consume_warnings() ); | |
| 743 | 748 | $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements ); |
| 744 | 749 | } |
| 745 | 750 | |
| 746 | 751 | if ( isset( $data['settings'] ) ) { |
| @@ -754,8 +759,19 @@ | ||
| 754 | 759 | } |
| 755 | 760 | |
| 756 | 761 | $document->save( $data ); |
| 757 | 762 | } |
| 763 | + } | |
| 764 | + | |
| 765 | + private function merge_atomic_prop_remap_warnings( array $warnings ): void { | |
| 766 | + if ( empty( $warnings ) ) { | |
| 767 | + return; | |
| 768 | + } | |
| 769 | + | |
| 770 | + $existing = $this->runners_import_metadata['atomic_prop_remap']['warnings'] ?? []; | |
| 771 | + $this->runners_import_metadata['atomic_prop_remap'] = [ | |
| 772 | + 'warnings' => array_merge( $existing, $warnings ), | |
| 773 | + ]; | |
| 758 | 774 | } |
| 759 | 775 | |
| 760 | 776 | private function update_instance_data_in_import_session_option() { |
| 761 | 777 | $import_sessions = Utils::get_import_sessions(); |