| @@ -25,8 +25,9 @@ | ||
| 25 | 25 | $platform = $this->get_param( 'platform', 'elementor' ); |
| 26 | 26 | $origin = $this->get_param( 'origin', 'remote' ); |
| 27 | 27 | $id = $this->get_param( 'id', 0, 'intval' ); |
| 28 | 28 | $postId = $this->get_param( 'postId', 0, 'intval' ); |
| 29 | + $settings = $this->get_param( 'settings', [], null ); | |
| 29 | 30 | |
| 30 | 31 | if( $id <= 0 || $id == null ) { |
| 31 | 32 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'get_content', 404 ); |
| 32 | 33 | } |
| @@ -73,9 +74,9 @@ | ||
| 73 | 74 | 'insert', 404 |
| 74 | 75 | ); |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | - return $this->platform( $platform )->insert( $template_data, $postId ); | |
| 78 | + return $this->platform( $platform )->insert( $template_data, $postId, $settings ); | |
| 78 | 79 | } |
| 79 | 80 | |
| 80 | 81 | private function get_cloud_content( $id = null, $platform = 'elementor' ){ |
| 81 | 82 | $response = $this->http()->query( |
| @@ -158,11 +159,13 @@ | ||
| 158 | 159 | return $template_data; |
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | public function import_in_library(){ |
| 162 | - $platform = $this->get_param( 'platform', 'elementor' ); | |
| 163 | - $id = $this->get_param( 'id', 0, 'intval' ); | |
| 164 | - $settings = $this->get_param( 'settings', [], null ); | |
| 163 | + $platform = $this->get_param( 'platform', 'elementor' ); | |
| 164 | + $id = $this->get_param( 'id', 0, 'intval' ); | |
| 165 | + $settings = $this->get_param( 'settings', [], null ); | |
| 166 | + $template_type = $this->get_param( 'template_type', '', 'sanitize_text_field' ); | |
| 167 | + $type = $this->get_param( 'type', '', 'sanitize_text_field' ); | |
| 165 | 168 | |
| 166 | 169 | if( $id == 0 ) { |
| 167 | 170 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 168 | 171 | } |
| @@ -178,9 +181,9 @@ | ||
| 178 | 181 | |
| 179 | 182 | @set_time_limit( 0 ); // Unlimited execution time for this request. |
| 180 | 183 | Utils::add_gd_editor_filter(); |
| 181 | 184 | |
| 182 | - return $this->platform( $platform )->import_in_library( $id, $this, $settings ); | |
| 185 | + return $this->platform( $platform )->import_in_library( $id, $this, $settings, $template_type, $type ); | |
| 183 | 186 | } |
| 184 | 187 | |
| 185 | 188 | public function import_as_page(){ |
| 186 | 189 | $platform = $this->get_param( 'platform', 'elementor' ); |
| @@ -185,9 +188,9 @@ | ||
| 185 | 188 | public function import_as_page(){ |
| 186 | 189 | $platform = $this->get_param( 'platform', 'elementor' ); |
| 187 | 190 | $id = $this->get_param( 'id', 0, 'intval' ); |
| 188 | 191 | $title = $this->get_param( 'title' ); |
| 189 | - $settings = $this->get_param( 'settings', [] ); | |
| 192 | + $settings = $this->get_param( 'settings', [], null ); | |
| 190 | 193 | |
| 191 | 194 | if( $id == 0 ) { |
| 192 | 195 | return $this->error('invalid_item_id', __( 'Invalid ID is provided.', 'templately' ), 'import/page', 404 ); |
| 193 | 196 | } |
| @@ -205,5 +208,5 @@ | ||
| 205 | 208 | Utils::add_gd_editor_filter(); |
| 206 | 209 | |
| 207 | 210 | return $this->platform( $platform )->create_page( $id, $title, $this, $settings ); |
| 208 | 211 | } |
| 209 | -} | |
| 212 | +} | |