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 / TitleField.php

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

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