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