PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/fields/FrmFieldGdpr.php +7 -35 6.296.21 View file →
@@ -9,9 +9,8 @@
9 9 class FrmFieldGdpr extends FrmFieldType {
10 10
11 11 /**
12 12 * @since 6.19
13 - *
14 13 * @var string
15 14 */
16 15 protected $type = 'gdpr';
17 16
@@ -16,9 +15,8 @@
16 15 protected $type = 'gdpr';
17 16
18 17 /**
19 18 * @since 6.19
20 - *
21 19 * @var bool
22 20 */
23 21 protected $has_for_label = false;
24 22
@@ -23,9 +21,8 @@
23 21 protected $has_for_label = false;
24 22
25 23 /**
26 24 * @since 6.19
27 - *
28 25 * @var string
29 26 */
30 27 const VIEW_PATH = '/classes/views/frm-fields/front-end/gdpr/gdpr-field.php';
31 28
@@ -32,9 +29,8 @@
32 29 /**
33 30 * Get the new field defaults.
34 31 *
35 32 * @since 6.19
36 - *
37 33 * @return array
38 34 */
39 35 public function get_new_field_defaults() {
40 36 if ( FrmFieldGdprHelper::hide_gdpr_field() ) {
@@ -61,9 +57,8 @@
61 57 /**
62 58 * Get the field settings for the field type.
63 59 *
64 60 * @since 6.19
65 - *
66 61 * @return bool[]
67 62 */
68 63 protected function field_settings_for_type() {
69 64 if ( FrmFieldGdprHelper::hide_gdpr_field() ) {
@@ -95,9 +90,8 @@
95 90 /**
96 91 * Show the primary options for the field.
97 92 *
98 93 * @since 6.19
99 - *
100 94 * @param array $args The arguments.
101 95 */
102 96 public function show_primary_options( $args ) {
103 97 if ( FrmFieldGdprHelper::hide_gdpr_field() ) {
@@ -102,9 +96,8 @@
102 96 public function show_primary_options( $args ) {
103 97 if ( FrmFieldGdprHelper::hide_gdpr_field() ) {
104 98 return;
105 99 }
106 -
107 100 $field = $args['field'];
108 101 include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/gdpr/primary-options.php';
109 102 }
110 103
@@ -118,9 +111,8 @@
118 111 /**
119 112 * Gets extra field options.
120 113 *
121 114 * @since 6.19
122 - *
123 115 * @return string[]
124 116 */
125 117 protected function extra_field_opts() {
126 118 return array(
@@ -131,9 +123,8 @@
131 123 /**
132 124 * Include the form builder file.
133 125 *
134 126 * @since 6.19
135 - *
136 127 * @return string
137 128 */
138 129 protected function include_form_builder_file() {
139 130 return FrmAppHelper::plugin_path() . self::VIEW_PATH;
@@ -142,9 +133,8 @@
142 133 /**
143 134 * Include the front form file.
144 135 *
145 136 * @since 6.19
146 - *
147 137 * @return string
148 138 */
149 139 protected function include_front_form_file() {
150 140 return FrmAppHelper::plugin_path() . self::VIEW_PATH;
@@ -156,9 +146,8 @@
156 146 * @since 6.19
157 147 *
158 148 * @param array $args The arguments.
159 149 * @param string $html The HTML.
160 - *
161 150 * @return string
162 151 */
163 152 protected function before_replace_html_shortcodes( $args, $html ) {
164 153 if ( FrmFieldGdprHelper::hide_gdpr_field() && ! current_user_can( 'frm_edit_forms' ) ) {
@@ -172,23 +161,20 @@
172 161 *
173 162 * @since 6.20
174 163 *
175 164 * @param array $args
176 - *
177 165 * @return array
178 166 */
179 167 public function validate( $args ) {
180 168 $errors = parent::validate( $args );
181 169
182 - if ( $errors || FrmFieldGdprHelper::hide_gdpr_field() ) {
183 - return $errors;
184 - }
170 + if ( ! $errors && ! FrmFieldGdprHelper::hide_gdpr_field() ) {
171 + $required = FrmField::get_option( $this->field, 'required' );
185 172
186 - $required = FrmField::get_option( $this->field, 'required' );
187 -
188 - if ( ! $required && empty( $args['value'] ) ) {
189 - $frm_settings = FrmAppHelper::get_settings();
190 - $errors[ 'field' . $args['id'] ] = str_replace( '[field_name]', is_object( $this->field ) ? $this->field->name : $this->field['name'], $frm_settings->blank_msg );
173 + if ( ! $required && empty( $args['value'] ) ) {
174 + $frm_settings = FrmAppHelper::get_settings();
175 + $errors[ 'field' . $args['id'] ] = str_replace( '[field_name]', is_object( $this->field ) ? $this->field->name : $this->field['name'], $frm_settings->blank_msg );
176 + }
191 177 }
192 178
193 179 return $errors;
194 180 }
@@ -199,28 +185,14 @@
199 185 * @since 6.20
200 186 *
201 187 * @param bool $required
202 188 * @param array $field
203 - *
204 189 * @return bool
205 190 */
206 191 public static function force_required_field( $required, $field ) {
207 192 if ( ! $required && 'gdpr' === $field['type'] && ! FrmFieldGdprHelper::hide_gdpr_field() ) {
208 - return true;
193 + $required = true;
209 194 }
210 195
211 196 return $required;
212 - }
213 -
214 - /**
215 - * Add the GDPR agreement text as an additional translatable string.
216 - *
217 - * @since 6.23
218 - *
219 - * @return array
220 - */
221 - public function translatable_strings() {
222 - $strings = parent::translatable_strings();
223 - $strings[] = 'gdpr_agreement_text';
224 - return $strings;
225 197 }
226 198 }