PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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 / modules / mcp / abilities / utils / document-mutation-save.php

document-mutation-save.php in Elementor Website Builder – more than just a page builder 4.3.0-beta3, at modules/mcp/abilities/utils/document-mutation-save.php

39 lines 748 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\Mcp\Abilities\Utils;
4
5 use Elementor\Core\Base\Document;
6 use Elementor\Core\Utils\Document\Document_Mutator;
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 class Document_Mutation_Save {
13
14 /**
15 * @return Document|\WP_Error
16 */
17 public static function elements_preserving_live_status(
18 Document_Mutator $mutator,
19 Document $document,
20 array $elements
21 ) {
22 $result = $mutator->save_as_draft( $document, $elements, true );
23
24 if ( is_wp_error( $result ) ) {
25 return $result;
26 }
27
28 if ( ! $result instanceof Document ) {
29 return new \WP_Error(
30 'elementor_save_failed',
31 __( 'Could not save document.', 'elementor' ),
32 [ 'status' => \WP_Http::INTERNAL_SERVER_ERROR ]
33 );
34 }
35
36 return $result;
37 }
38 }
39