PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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 / StandaloneFormView.php

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

36 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 StandaloneFormView {
9 public static function preview() {
10 $requestUri = $_SERVER['REQUEST_URI'];
11 $uri = explode('/', $requestUri);
12
13 if (is_array($uri) && count($uri) > 0) {
14 $formID = $uri[count($uri) - 1];
15
16 $frontendFormHandler = new FrontendFormHandler();
17 $formViewObject = $frontendFormHandler->handleFrontendRenderRequest($formID, true);
18 if ('string' === gettype($formViewObject)) {
19 Render::view('views/form-not-found');
20 exit;
21 }
22
23 $formHTML = $formViewObject->html;
24 $font = $formViewObject->font;
25 $bfGlobals = $formViewObject->bfGlobals;
26
27 if (defined('BITAPPS_DEV') && BITAPPS_DEV) {
28 set_transient('bitform_form_preview', true);
29 $frontendFormHandler->generateJs($formID);
30 $title = 'BitForm Preview page';
31 Render::view('views/preview-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals'));
32 }
33 }
34 }
35 }
36