function et_fb_retrieve_builder_data() { if (!isset($_POST['et_fb_helper_nonce']) || !wp_verify_nonce($_POST['et_fb_helper_nonce'], 'et_fb_backend_helper_nonce')) { die(-1); } if (!current_user_can('edit_posts')) { die(-1); } $post_type = !empty($_POST['et_post_type']) ? sanitize_text_field($_POST['et_post_type']) : 'post'; $post_id = !empty($_POST['et_post_id']) ? sanitize_text_field($_POST['et_post_id']) : ''; $layout_type = !empty($_POST['et_layout_type']) ? sanitize_text_field($_POST['et_layout_type']) : ''; $fields_data = array(); $fields_data['custom_css'] = ET_Builder_Element::get_custom_css_fields($post_type); $fields_data['advanced_fields'] = ET_Builder_Element::get_advanced_fields($post_type); $fields_data['general_fields'] = ET_Builder_Element::get_general_fields($post_type); $post_data = get_post($post_id); $post_content = $post_data->post_content; switch ($layout_type) { case 'module': $use_fullwidth_section = false !== strpos($post_content, '[et_pb_fullwidth_') ? true : false; if (!$use_fullwidth_section) { $post_content = sprintf('[et_pb_row][et_pb_column type="4_4"]%1$s[/et_pb_column][/et_pb_row]', $post_content); } $post_content = sprintf('[et_pb_section%2$s]%1$s[/et_pb_section]', $post_content, $use_fullwidth_section ? ' fullwidth="on"' : ''); break; case 'row': $post_content = '[et_pb_section]' . $post_content . '[/et_pb_section]'; break; } $fields_data['shortcode_object'] = et_fb_process_shortcode($post_content); die(json_encode($fields_data)); }