PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev3
Elementor Website Builder – more than just a page builder v3.32.0-dev3
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / app / modules / import-export-customization / runners / revert / templates.php

templates.php in Elementor Website Builder – more than just a page builder 3.32.0-dev3, at app/modules/import-export-customization/runners/revert/templates.php

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\App\Modules\ImportExportCustomization\Runners\Revert;
4
5 use Elementor\Plugin;
6 use Elementor\TemplateLibrary\Source_Local;
7 use Elementor\Core\Base\Document;
8
9 class Templates extends Revert_Runner_Base {
10 public static function get_name(): string {
11 return 'templates';
12 }
13
14 public function should_revert( array $data ): bool {
15 return (
16 isset( $data['runners'] ) &&
17 array_key_exists( static::get_name(), $data['runners'] )
18 );
19 }
20
21 public function revert( array $data ) {
22 $template_types = array_values( Source_Local::get_template_types() );
23
24 $query_args = [
25 'post_type' => Source_Local::CPT,
26 'post_status' => 'any',
27 'posts_per_page' => -1,
28 'meta_query' => [
29 [
30 'key' => Document::TYPE_META_KEY,
31 'value' => $template_types,
32 ],
33 [
34 'key' => static::META_KEY_ELEMENTOR_IMPORT_SESSION_ID,
35 'value' => $data['session_id'],
36 ],
37 ],
38 ];
39
40 $templates_query = new \WP_Query( $query_args );
41
42 foreach ( $templates_query->posts as $template_post ) {
43 $template_document = Plugin::$instance->documents->get( $template_post->ID );
44 $template_document->delete();
45 }
46
47 do_action( 'elementor/import-export-customization/revert/templates', $data );
48 }
49 }
50