← All changes
|
app/modules/import-export-customization/processes/import.php
+16
-0
4.2.0-dev2
→
4.3.0-beta3
View file →
| @@ -8,8 +8,10 @@ | ||
| 8 | 8 | use Elementor\App\Modules\ImportExportCustomization\Compatibility\Customization; |
| 9 | 9 | use Elementor\App\Modules\ImportExportCustomization\Utils; |
| 10 | 10 | use Elementor\Core\Base\Document; |
| 11 | 11 | use Elementor\Core\Kits\Documents\Kit; |
| 12 | +use Elementor\Modules\AtomicWidgets\Utils\Atomic_Prop_Remap; | |
| 13 | +use Elementor\Modules\Components\Module as Components_Module; | |
| 12 | 14 | use Elementor\Plugin; |
| 13 | 15 | |
| 14 | 16 | use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Elementor_Content; |
| 15 | 17 | use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Import_Runner_Base; |
| @@ -783,8 +785,11 @@ | ||
| 783 | 785 | foreach ( $this->documents_data as $new_id => $data ) { |
| 784 | 786 | $document = Plugin::$instance->documents->get( $new_id ); |
| 785 | 787 | |
| 786 | 788 | if ( isset( $data['elements'] ) ) { |
| 789 | + $data['elements'] = Components_Module::prepare_imported_elements( $data['elements'], $imported_data_replacements['post_ids'] ?? [] ); | |
| 790 | + $data['elements'] = Atomic_Prop_Remap::apply( $data['elements'], $imported_data_replacements ); | |
| 791 | + $this->merge_atomic_prop_remap_warnings( Atomic_Prop_Remap::consume_warnings() ); | |
| 787 | 792 | $data['elements'] = $document->on_import_update_dynamic_content( $data['elements'], $imported_data_replacements ); |
| 788 | 793 | } |
| 789 | 794 | |
| 790 | 795 | if ( isset( $data['settings'] ) ) { |
| @@ -798,8 +803,19 @@ | ||
| 798 | 803 | } |
| 799 | 804 | |
| 800 | 805 | $document->save( $data ); |
| 801 | 806 | } |
| 807 | + } | |
| 808 | + | |
| 809 | + private function merge_atomic_prop_remap_warnings( array $warnings ): void { | |
| 810 | + if ( empty( $warnings ) ) { | |
| 811 | + return; | |
| 812 | + } | |
| 813 | + | |
| 814 | + $existing = $this->runners_import_metadata['atomic_prop_remap']['warnings'] ?? []; | |
| 815 | + $this->runners_import_metadata['atomic_prop_remap'] = [ | |
| 816 | + 'warnings' => array_merge( $existing, $warnings ), | |
| 817 | + ]; | |
| 802 | 818 | } |
| 803 | 819 | |
| 804 | 820 | private function update_instance_data_in_import_session_option() { |
| 805 | 821 | $import_sessions = Utils::get_import_sessions(); |