| @@ -1,8 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentForm\App\Modules; |
| 4 | 4 | |
| 5 | +defined('ABSPATH') or die; | |
| 6 | + | |
| 7 | +use FluentForm\App\Models\Form; | |
| 5 | 8 | use FluentForm\App\Modules\Acl\Acl; |
| 6 | 9 | |
| 7 | 10 | class ProcessExteriorModule |
| 8 | 11 | { |
| @@ -7,29 +10,36 @@ | ||
| 7 | 10 | class ProcessExteriorModule |
| 8 | 11 | { |
| 9 | 12 | public function handleExteriorPages() |
| 10 | 13 | { |
| 11 | - if(defined('CT_VERSION')) { | |
| 14 | + if (defined('CT_VERSION')) { | |
| 12 | 15 | // oxygen page compatibility |
| 13 | - remove_action( 'wp_head', 'oxy_print_cached_css', 999999 ); | |
| 16 | + remove_action('wp_head', 'oxy_print_cached_css', 999999); | |
| 14 | 17 | } |
| 15 | - | |
| 16 | - $this->renderFormPreview(intval($_GET['preview_id'])); | |
| 18 | + wp_register_script( | |
| 19 | + 'fluentform_editor_helper', | |
| 20 | + fluentFormMix('js/fluent_forms_editor_helper.js'), | |
| 21 | + array('jquery'), | |
| 22 | + FLUENTFORM_VERSION, | |
| 23 | + true | |
| 24 | + ); | |
| 25 | + $this->renderFormPreview(intval(wpFluentForm('request')->get('preview_id'))); | |
| 17 | 26 | } |
| 18 | 27 | |
| 19 | 28 | public function renderFormPreview($form_id) |
| 20 | 29 | { |
| 21 | 30 | if (Acl::hasAnyFormPermission($form_id)) { |
| 22 | - add_filter('fluentform_is_form_renderable', function ($renderable) { | |
| 31 | + add_filter('fluentform/is_form_renderable', function ($renderable) { | |
| 23 | 32 | $renderable['status'] = true; |
| 24 | 33 | return $renderable; |
| 25 | 34 | }); |
| 26 | - | |
| 27 | - $form = wpFluent()->table('fluentform_forms')->find($form_id); | |
| 35 | + | |
| 36 | + $form = Form::find($form_id); | |
| 28 | 37 | if ($form) { |
| 29 | - echo \FluentForm\View::make('frameless.show_review', [ | |
| 38 | + wp_enqueue_script('fluentform_editor_helper'); | |
| 39 | + wpFluentForm('view')->render('frameless.show_preview', [ | |
| 30 | 40 | 'form_id' => $form_id, |
| 31 | - 'form' => $form | |
| 41 | + 'form' => $form, | |
| 32 | 42 | ]); |
| 33 | 43 | exit(); |
| 34 | 44 | } |
| 35 | 45 | } |