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
3.3.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 All 138 releases
bit-form / includes / Frontend / Form / View / Theme / Fields / ButtonField.php

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

65 lines 2.6 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\Form\View\Theme\Fields;
4
5 class ButtonField {
6 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null) {
7 $inputWrapper = new InputWrapper($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
8 $button = self::field($field, $rowID, $form_atomic_Cls_map, $formID);
9 return $inputWrapper->wrapper($button, true, true);
10 }
11
12 private static function field($field, $rowID, $form_atomic_Cls_map, $formID, $error = null, $value = null) {
13 $fieldHelpers = new FieldHelpers($field, $rowID, $form_atomic_Cls_map);
14 // $helperTxt = self::helperTxt($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null);
15
16 $btnPreIcn = $fieldHelpers->icon('btnPreIcn', 'btn-pre-i');
17 $btnSufIcn = $fieldHelpers->icon('btnSufIcn', 'btn-suf-i');
18 $disabled = $fieldHelpers->disabled();
19 // $name = $field->btnTyp === 'submit' ? 'name="bit-form-submit-btn"' : '';
20 $name = $fieldHelpers->name();
21 $spanner = '<span class="' . $fieldHelpers->getAtomicCls('spanner') . ' d-none"></span>';
22 $submitSpanner = 'submit' === $field->btnTyp ? $spanner : '';
23
24 return <<<BUTTONFIELD
25 <div class="{$fieldHelpers->getAtomicCls('inp-fld-wrp')} {$fieldHelpers->getCustomClasses('inp-fld-wrp')}"
26 {$fieldHelpers->getCustomAttributes('inp-fld-wrp')}
27 >
28 <button
29 class="{$fieldHelpers->getAtomicCls('btn')} {$fieldHelpers->getCustomClasses('btn')}"
30 {$fieldHelpers->getCustomAttributes('btn')}
31 type="{$field->btnTyp}"
32 {$name}
33 {$disabled}
34 >
35 {$btnPreIcn}
36 {$fieldHelpers->renderHTMR($field->txt)}
37 {$btnSufIcn}
38 {$submitSpanner}
39 </button>
40 </div>
41 BUTTONFIELD;
42 }
43
44 private static function helperTxt($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null) {
45 $fieldHelpers = new FieldHelpers($field, $rowID, $form_atomic_Cls_map);
46 $hlpPreIcn = $fieldHelpers->icon('hlpPreIcn', 'hlp-txt-pre-i');
47 $hlpSufIcn = $fieldHelpers->icon('hlpSufIcn', 'hlp-txt-suf-i');
48 $hlpTxt = isset($field->helperTxt) ? $fieldHelpers->renderHTMR($field->helperTxt) : '';
49
50 $helperTxt = <<<HELPERTXT
51 <div
52 class="{$fieldHelpers->getAtomicCls('hlp-txt')} {$fieldHelpers->getCustomClasses('hlp-txt')}"
53 {$fieldHelpers->getCustomAttributes('hlp-txt')}
54 >
55 {$hlpPreIcn}
56 {$hlpTxt}
57 {$hlpSufIcn}
58 </div>
59
60 HELPERTXT;
61
62 return property_exists($field, 'helperTxt') ? $helperTxt : '';
63 }
64 }
65