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

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

94 lines 3.3 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 use BitCode\BitForm\Core\Util\FieldValueHandler;
6
7 class TitleField
8 {
9 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
10 {
11 return self::field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
12 }
13
14 private static function titleGenerator($tag, $text, $cls, $preIcn, $sufIcn, $fk, $field, $form_atomic_Cls_map)
15 {
16 $text = FieldValueHandler::replaceSmartTagWithValue($text);
17 $fieldHelpers = new ClassicFieldHelpers($field, $fk, $form_atomic_Cls_map);
18
19 return <<<TITLEGENERATOR
20 <{$tag} class="{$fieldHelpers->getAtomicCls($cls)} {$fieldHelpers->getCustomClasses($cls)}">
21 {$preIcn}
22 {$fieldHelpers->kses_post($text)}
23 {$sufIcn}
24 </{$tag}>
25 TITLEGENERATOR;
26 }
27
28 private static function iconImg($field, $object, $element, $fieldHelpers, $alt, $fk)
29 {
30 return <<<ICONIMG
31 <img
32 {$fieldHelpers->getCustomAttributes($element)}
33 class="{$fieldHelpers->getAtomicCls($element)} {$fieldHelpers->getCustomClasses($element)}"
34 src="{$fieldHelpers->esc_url($field->$object)}"
35 alt="{$fieldHelpers->esc_attr($alt)}"
36 />
37 ICONIMG;
38 }
39
40 private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
41 {
42 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
43
44 $logo = $fieldHelpers->icon('logo', 'logo');
45 $titleHide = '';
46 $subtitleHide = '';
47
48 $titlePreIcn = '';
49 $titleSufIcn = '';
50 $subTitlPreIcn = '';
51 $subTitlSufIcn = '';
52
53 if (property_exists($field, 'titlePreIcn')) {
54 $titlePreIcn = self::iconImg($field, 'titlePreIcn', 'title-pre-i', $fieldHelpers, 'Title Prefix Icon', $rowID);
55 }
56
57 if (property_exists($field, 'titleSufIcn')) {
58 $titleSufIcn = self::iconImg($field, 'titleSufIcn', 'title-suf-i', $fieldHelpers, 'Title Suffix Icon', $rowID);
59 }
60
61 if (property_exists($field, 'subTitlPreIcn')) {
62 $subTitlPreIcn = self::iconImg($field, 'subTitlPreIcn', 'sub-titl-pre-i', $fieldHelpers, 'Subtitle Prefix Icon', $rowID);
63 }
64
65 if (property_exists($field, 'subTitlSufIcn')) {
66 $subTitlSufIcn = self::iconImg($field, 'subTitlSufIcn', 'sub-titl-suf-i', $fieldHelpers, 'Subtitle Suffix Icon', $rowID);
67 }
68
69 if (property_exists($field, 'titleHide') && !$field->titleHide) {
70 $titleHide = self::titleGenerator($field->titleTag, $field->title, 'title', $titlePreIcn, $titleSufIcn, $rowID, $field, $form_atomic_Cls_map);
71 }
72
73 if (property_exists($field, 'subtitleHide') && !$field->subtitleHide) {
74 $subtitleHide = self::titleGenerator($field->subTitleTag, $field->subtitle, 'sub-titl', $subTitlPreIcn, $subTitlSufIcn, $rowID, $field, $form_atomic_Cls_map);
75 }
76
77 return <<<TITLEFIELD
78 <div
79 {$fieldHelpers->getCustomAttributes('fld-wrp')}
80 class="{$fieldHelpers->getAtomicCls('fld-wrp')} {$fieldHelpers->getCustomClasses('fld-wrp')}"
81 >
82 {$logo}
83 <div
84 {$fieldHelpers->getCustomAttributes('titl-wrp')}
85 class="{$fieldHelpers->getAtomicCls('titl-wrp')} {$fieldHelpers->getCustomClasses('titl-wrp')}"
86 >
87 {$titleHide}
88 {$subtitleHide}
89 </div>
90 </div>
91 TITLEFIELD;
92 }
93 }
94