PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8
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/FrmFieldFormHtml.php +13 -27 6.56.8 View file →
@@ -5,9 +5,8 @@
5 5
6 6 /**
7 7 * @since 3.0
8 8 */
9 -
10 9 class FrmFieldFormHtml {
11 10
12 11 private $html;
13 12
@@ -41,9 +40,9 @@
41 40 /**
42 41 * @since 3.0
43 42 *
44 43 * @param string $param
45 - * @param array $atts
44 + * @param array $atts
46 45 */
47 46 private function _set( $param, $atts ) {
48 47 if ( isset( $atts[ $param ] ) ) {
49 48 $this->{$param} = $atts[ $param ];
@@ -144,18 +143,18 @@
144 143 /**
145 144 * @since 3.0
146 145 */
147 146 private function replace_field_values() {
148 - //replace [id]
147 + // Replace [id].
149 148 $this->html = str_replace( '[id]', $this->field_id, $this->html );
150 149
151 150 // set the label for
152 151 $this->html = str_replace( 'field_[key]', $this->html_id, $this->html );
153 152
154 - //replace [key]
153 + // Replace [key].
155 154 $this->html = str_replace( '[key]', $this->field_obj->get_field_column( 'field_key' ), $this->html );
156 155
157 - //replace [field_name]
156 + // Replace [field_name].
158 157 $this->html = str_replace( '[field_name]', FrmAppHelper::maybe_kses( $this->field_obj->get_field_column( 'name' ) ), $this->html );
159 158 }
160 159
161 160 /**
@@ -295,12 +294,12 @@
295 294 private function replace_form_shortcodes() {
296 295 if ( ! empty( $this->form ) ) {
297 296 $form = (array) $this->form;
298 297
299 - //replace [form_key]
298 + // Replace [form_key].
300 299 $this->html = str_replace( '[form_key]', $form['form_key'], $this->html );
301 300
302 - //replace [form_name]
301 + // Replace [form_name].
303 302 $this->html = str_replace( '[form_name]', $form['name'], $this->html );
304 303 }
305 304 }
306 305
@@ -321,9 +320,9 @@
321 320 */
322 321 private function filter_for_more_shortcodes() {
323 322 $atts = $this->pass_args;
324 323
325 - //If field is not in repeating section
324 + // If field is not in repeating section.
326 325 if ( empty( $atts['section_id'] ) ) {
327 326 $atts = array(
328 327 'errors' => $this->pass_args['errors'],
329 328 'form' => $this->form,
@@ -500,25 +499,17 @@
500 499 if ( ! in_array( $field_type, array( 'radio', 'checkbox', 'data', 'product', 'scale' ), true ) ) {
501 500 return;
502 501 }
503 502
504 - $field = (array) $this->field_obj->get_field();
505 - $attributes = array();
506 - $is_radio = 'radio' === $field_type || 'scale' === $field_type;
507 - $type_requires_aria_required = true;
503 + $field = (array) $this->field_obj->get_field();
504 + $attributes = array();
508 505
509 506 // Check if the field type is 'data' or 'product'.
510 507 if ( in_array( $field_type, array( 'data', 'product' ), true ) ) {
511 508 $data_type = FrmField::get_option( $field, 'data_type' );
512 - // Check if the data type isn't 'radio' or 'checkbox'.
513 - if ( 'radio' !== $data_type && 'checkbox' !== $data_type ) {
514 - // If data type aren't 'radio' or 'checkbox', doesn't need to add 'aria-required' to multiple input container.
515 - $type_requires_aria_required = false;
516 - }
517 - // Check if data type is 'radio'
518 - if ( 'radio' === $data_type ) {
519 - $is_radio = true;
520 - }
509 + $is_radio = 'radio' === $data_type;
510 + } else {
511 + $is_radio = 'radio' === $field_type || 'scale' === $field_type;
521 512 }
522 513
523 514 // Add 'role' attribute to the field.
524 515 $attributes['role'] = $is_radio ? 'radiogroup' : 'group';
@@ -523,15 +514,10 @@
523 514 // Add 'role' attribute to the field.
524 515 $attributes['role'] = $is_radio ? 'radiogroup' : 'group';
525 516
526 517 // Add 'aria-required' attribute to the field if required.
527 - if ( $type_requires_aria_required && '1' === $field['required'] ) {
518 + if ( $is_radio && '1' === $field['required'] ) {
528 519 $attributes['aria-required'] = 'true';
529 - }
530 -
531 - // Add 'tabindex = "0"' attribute to the radio field.
532 - if ( $is_radio ) {
533 - $attributes['tabindex'] = 0;
534 520 }
535 521
536 522 // Concatenate attributes into a string, and replace the role="group" in the HTML with the attributes string.
537 523 $html_attributes = FrmAppHelper::array_to_html_params( $attributes );