PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.1
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Frontend / FormEntryView.php

FormEntryView.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.9.1, at includes/Frontend/FormEntryView.php

39 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Frontend;
4
5 use BitCode\BitForm\Core\Util\Render;
6 use BitCode\BitForm\Frontend\Form\FrontendFormHandler;
7
8 class FormEntryView
9 {
10 public static function preview()
11 {
12 $requestUri = $_SERVER['REQUEST_URI'];
13 $uri = explode('/', $requestUri);
14
15 if (is_array($uri) && count($uri) > 0) {
16 $formID = $uri[count($uri) - 2];
17 $entryID = $uri[count($uri) - 1];
18 $attr = ['form_id' => $formID, 'entry_id' => $entryID, 'form_preview' => true];
19
20 $frontendFormHandler = new FrontendFormHandler();
21 $formViewObject = $frontendFormHandler->handleFrontendRenderRequest($attr);
22 if ('string' === gettype($formViewObject)) {
23 Render::view('views/form-not-found');
24 exit;
25 }
26
27 $formHTML = $formViewObject->html;
28 $font = $formViewObject->font;
29 $bfGlobals = $formViewObject->bfGlobals;
30
31 set_transient('bitform_form_preview', true);
32 $frontendFormHandler->generateJs($formID, $entryID);
33 $title = 'BitForm Entry edit';
34 Render::view('views/entry-edit-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals'));
35
36 }
37 }
38 }
39