PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.1
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.1
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / templates / class-abstract-template.php

class-abstract-template.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.1, at includes/templates/class-abstract-template.php

168 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Form template abstract class
5 *
6 * @since 1.1.0
7 */
8 abstract class WeForms_Form_Template {
9
10 /**
11 * If the form is enabled
12 *
13 * @var bool
14 */
15 public $enabled = true;
16
17 /**
18 * Template title
19 *
20 * @var string
21 */
22 public $title;
23
24 /**
25 * Template description
26 *
27 * @var string
28 */
29 public $description;
30
31 /**
32 * Conditional logic
33 *
34 * @var array
35 */
36 protected $conditionals;
37
38 /**
39 * Form fields
40 *
41 * @var array
42 */
43 protected $form_fields;
44
45 /**
46 * Form settings
47 *
48 * @var array
49 */
50 protected $form_settings;
51
52 /**
53 * Form Template Category
54 *
55 * @var array
56 */
57 public $category = 'default';
58
59 /**
60 * Form Template Image
61 *
62 * @var array
63 */
64 public $image;
65
66 /**
67 * Form notifications
68 *
69 * @since 2.5.2
70 *
71 * @var array
72 */
73 protected $form_notifications;
74
75 public function __construct() {
76 $this->conditionals = [
77 'condition_status' => 'no',
78 'cond_field' => [],
79 'cond_operator' => [ '=' ],
80 'cond_option' => [ '- select -' ],
81 'cond_logic' => 'all',
82 ];
83 }
84
85 /**
86 * Get the template title
87 *
88 * @return string
89 */
90 public function get_title() {
91 return $this->title;
92 }
93
94 /**
95 * Get the description
96 *
97 * @return string
98 */
99 public function get_description() {
100 return $this->description;
101 }
102
103 /**
104 * Get the form fields
105 *
106 * @return array
107 */
108 public function get_form_fields() {
109 return $this->form_fields;
110 }
111
112 /**
113 * Get all available fields
114 *
115 * @return array
116 */
117 public function get_available_fields() {
118 return weforms()->fields->get_fields();
119 }
120
121 /**
122 * Get the form settings
123 *
124 * @return array
125 */
126 public function get_form_settings() {
127 return $this->get_default_settings();
128 }
129
130 /**
131 * Get form notifications
132 *
133 * @since 2.5.2
134 *
135 * @return array
136 */
137 public function get_form_notifications() {
138 return $this->get_default_notification();
139 }
140
141 /**
142 * Check if the template is enabled
143 *
144 * @return bool
145 */
146 public function is_enabled() {
147 return $this->enabled;
148 }
149
150 /**
151 * Get default settings
152 *
153 * @return array
154 */
155 public function get_default_settings() {
156 return weforms_get_default_form_settings();
157 }
158
159 /**
160 * Get notifications of contact form template
161 *
162 * @return array
163 */
164 public function get_default_notification() {
165 return [ weforms_get_default_form_notification() ];
166 }
167 }
168