PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16
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/FrmFieldName.php +44 -3 6.36.16 View file →
@@ -32,11 +32,11 @@
32 32 parent::__construct( $field, $type );
33 33
34 34 $this->register_sub_fields(
35 35 array(
36 - 'first' => __( 'First', 'formidable' ),
37 - 'middle' => __( 'Middle', 'formidable' ),
38 - 'last' => __( 'Last', 'formidable' ),
36 + 'first' => __( 'First Name', 'formidable' ),
37 + 'middle' => __( 'Middle Name', 'formidable' ),
38 + 'last' => __( 'Last Name', 'formidable' ),
39 39 )
40 40 );
41 41 }
42 42
@@ -236,6 +236,47 @@
236 236 $attrs = parent::get_inputs_container_attrs();
237 237
238 238 $attrs['data-name-layout'] = $this->get_name_layout();
239 239 return $attrs;
240 + }
241 +
242 + /**
243 + * Maybe show a warning if a name field is using a description that is not descriptive enough.
244 + * Prior to version 6.16, First and Last were the default values, but this has been updated to
245 + * improve accessibility.
246 + *
247 + * @since 6.16
248 + *
249 + * @param array $args
250 + * @return void
251 + */
252 + public function show_after_default( $args ) {
253 + parent::show_after_default( $args );
254 +
255 + /**
256 + * @var array $field
257 + */
258 + $field = $args['field'];
259 +
260 + $show_warning = false;
261 + foreach ( $this->sub_fields as $name => $sub_field ) {
262 + $description = FrmField::get_option( $field, $sub_field['name'] . '_desc' );
263 + if ( in_array( $description, array( 'First', 'Last' ), true ) ) {
264 + $show_warning = true;
265 + break;
266 + }
267 + }
268 +
269 + if ( ! $show_warning ) {
270 + return;
271 + }
272 + ?>
273 + <div class="frm_warning_style">
274 + <?php
275 + FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon', array( 'style' => 'width:24px' ) );
276 + echo ' ';
277 + esc_html_e( 'Subfield descriptions are read by screen readers. Enhance accessibility by using complete labels, like "First Name" instead of "First".', 'formidable' );
278 + ?>
279 + </div>
280 + <?php
240 281 }
241 282 }