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 / Form / View / Theme / Fields / TitleField.php

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

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