PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.1.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.1.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 / ImageField.php

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

50 lines 1.4 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\Admin\Form\Helpers;
6
7 class ImageField
8 {
9 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
10 {
11 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
12 $imgHeight = intval(Helpers::property_exists_nested($field, 'height', '', 1) ? $field->height : 100);
13 $imgWidth = intval(Helpers::property_exists_nested($field, 'width', '', 1) ? $field->width : 40);
14
15 $imgSrc = Helpers::property_exists_nested($field, 'bg_img', '', 1) ? $field->bg_img : '';
16 $alt = Helpers::property_exists_nested($field, 'alt', '', 1) ? $field->alt : '';
17
18 $img = sprintf(
19 '<img
20 %1$s
21 class="%2$s %3$s"
22 src="%4$s"
23 alt="%5$s"
24 width="%6$s"
25 height="%7$s"
26 />',
27 $fieldHelpers->getCustomAttributes('img'),
28 $fieldHelpers->getAtomicCls('img'),
29 $fieldHelpers->getCustomClasses('img'),
30 $fieldHelpers->esc_url($imgSrc),
31 $fieldHelpers->esc_attr($alt),
32 $fieldHelpers->esc_attr($imgWidth),
33 $fieldHelpers->esc_attr($imgHeight)
34 );
35
36 return sprintf(
37 '<div
38 %1$s
39 class="%2$s %3$s"
40 >
41 %4$s
42 </div>',
43 $fieldHelpers->getCustomAttributes('fld-wrp'),
44 $fieldHelpers->getAtomicCls('fld-wrp'),
45 $fieldHelpers->getCustomClasses('fld-wrp'),
46 $img
47 );
48 }
49 }
50