PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.1.10
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.1.10
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Core/Platform/Gutenberg.php +1 -28 3.6.13.1.10 View file →
@@ -46,9 +46,8 @@
46 46 */
47 47 public function hooks(){
48 48 add_action( 'enqueue_block_editor_assets', [ $this, 'scripts' ] );
49 49 add_action( 'admin_footer', [ $this, 'print_admin_js_template' ] );
50 - add_action( 'wp_ajax_update_gutenberg_hide_buttons', [ $this, 'update_gutenberg_hide_buttons' ] ); // Register AJAX action
51 50 }
52 51
53 52 /**
54 53 * Assets Enqueueing
@@ -56,9 +55,8 @@
56 55 */
57 56 public function scripts(){
58 57 $this->is_gutenberg_active = true;
59 58 templately()->assets->enqueue( 'templately-gutenberg', 'css/gutenberg.css' );
60 - templately()->assets->enqueue( 'templately-tailwind', 'css/tailwind.css', ['templately-gutenberg'] );
61 59 templately()->assets->enqueue( 'templately-gutenberg', 'js/gutenberg.js' );
62 60 templately()->admin->scripts( 'gutenberg' );
63 61 }
64 62
@@ -110,9 +108,9 @@
110 108 * @since 2.0.0
111 109 *
112 110 * @return array|WP_Error array on success, WP_Error on failure.
113 111 */
114 - public function create_page( $id, $title, $importer = null, $settings = [] ){
112 + public function create_page( $id, $title, $importer = null ){
115 113 $post_data = $inserted_ID = $importer->get_content( $id, 'gutenberg' );
116 114
117 115 if( is_wp_error( $inserted_ID ) ) {
118 116 return $inserted_ID;
@@ -117,13 +115,8 @@
117 115 if( is_wp_error( $inserted_ID ) ) {
118 116 return $inserted_ID;
119 117 }
120 118
121 - if ( ! empty( $settings ) && ! empty( $inserted_ID['content'] ) && is_string( $inserted_ID['content'] ) ) {
122 - $inserted_ID['content'] = \Templately\Core\Importer\Utils\GutenbergSettingsMerger::merge( $inserted_ID['content'], $settings );
123 - $post_data['content'] = $inserted_ID['content'];
124 - }
125 -
126 119 if ( ! empty( $inserted_ID['content'] ) ) {
127 120 $inserted_ID = wp_insert_post( array (
128 121 'post_status' => 'draft',
129 122 'post_type' => 'page',
@@ -170,25 +163,5 @@
170 163 $data['content'] = Utils::import_and_replace_attachments($data['content'], $postId);
171 164 return $data;
172 165 }
173 166
174 - /**
175 - * AJAX handler to update the option `templately-gutenberg-hide-buttons`
176 - */
177 - public function update_gutenberg_hide_buttons() {
178 - // Check nonce for security
179 - check_ajax_referer( 'templately_nonce', 'nonce' );
180 -
181 - // Get the new value from the AJAX request
182 - $hide_buttons = isset($_GET['hide_buttons']) ? sanitize_text_field($_GET['hide_buttons']) : '';
183 -
184 - // Update the option
185 - update_option('templately-gutenberg-hide-buttons', $hide_buttons);
186 -
187 - $hide_buttons = get_option('templately-gutenberg-hide-buttons', 'no');
188 - $hide_buttons = $hide_buttons === 'yes' ? 'yes' : 'no';
189 - // Send a response back to the JavaScript
190 - wp_send_json_success([
191 - 'hide_buttons' => $hide_buttons,
192 - ]);
193 - }
194 167 }