| @@ -136,10 +136,8 @@ | ||
| 136 | 136 | $this->replace_entry_key(); |
| 137 | 137 | $this->replace_form_shortcodes(); |
| 138 | 138 | $this->process_wp_shortcodes(); |
| 139 | 139 | $this->maybe_replace_description_shortcode( true ); |
| 140 | - | |
| 141 | - $this->add_multiple_input_attributes(); | |
| 142 | 140 | } |
| 143 | 141 | |
| 144 | 142 | /** |
| 145 | 143 | * @since 3.0 |
| @@ -410,8 +408,11 @@ | ||
| 410 | 408 | */ |
| 411 | 409 | private function add_class_to_label() { |
| 412 | 410 | $label_class = $this->field_obj->get_label_class(); |
| 413 | 411 | $this->html = str_replace( '[label_position]', $label_class, $this->html ); |
| 412 | + if ( $this->field_obj->get_field_column( 'label' ) == 'inside' && $this->field_obj->get_field_column( 'value' ) != '' ) { | |
| 413 | + $this->html = str_replace( 'frm_primary_label', 'frm_primary_label frm_visible', $this->html ); | |
| 414 | + } | |
| 414 | 415 | } |
| 415 | 416 | |
| 416 | 417 | /** |
| 417 | 418 | * Replace [entry_key] |
| @@ -451,15 +452,9 @@ | ||
| 451 | 452 | |
| 452 | 453 | // Add label position class |
| 453 | 454 | $settings = $this->field_obj->display_field_settings(); |
| 454 | 455 | if ( isset( $settings['label_position'] ) && $settings['label_position'] ) { |
| 455 | - $label_position = $this->field_obj->get_field_column( 'label' ); | |
| 456 | - $classes .= ' frm_' . $label_position . '_container'; | |
| 457 | - | |
| 458 | - // Add class if field has value, to be used for floating label styling. | |
| 459 | - if ( 'inside' === $label_position && $this->field_obj->get_field_column( 'value' ) ) { | |
| 460 | - $classes .= ' frm_label_float_top'; | |
| 461 | - } | |
| 456 | + $classes .= ' frm_' . $this->field_obj->get_field_column( 'label' ) . '_container'; | |
| 462 | 457 | } |
| 463 | 458 | |
| 464 | 459 | // Add CSS layout classes |
| 465 | 460 | $extra_classes = $this->field_obj->get_field_column( 'classes' ); |
| @@ -484,57 +479,6 @@ | ||
| 484 | 479 | private function process_wp_shortcodes() { |
| 485 | 480 | if ( apply_filters( 'frm_do_html_shortcodes', true ) ) { |
| 486 | 481 | $this->html = do_shortcode( $this->html ); |
| 487 | 482 | } |
| 488 | - } | |
| 489 | - | |
| 490 | - /** | |
| 491 | - * Adds multiple input attributes. | |
| 492 | - * | |
| 493 | - * @since 6.4.1 | |
| 494 | - * @return void | |
| 495 | - */ | |
| 496 | - private function add_multiple_input_attributes() { | |
| 497 | - $field_type = $this->field_obj->get_field_column( 'type' ); | |
| 498 | - | |
| 499 | - // Check if the field type is one of the following. | |
| 500 | - if ( ! in_array( $field_type, array( 'radio', 'checkbox', 'data', 'product', 'scale' ), true ) ) { | |
| 501 | - return; | |
| 502 | - } | |
| 503 | - | |
| 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; | |
| 508 | - | |
| 509 | - // Check if the field type is 'data' or 'product'. | |
| 510 | - if ( in_array( $field_type, array( 'data', 'product' ), true ) ) { | |
| 511 | - $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 | - } | |
| 521 | - } | |
| 522 | - | |
| 523 | - // Add 'role' attribute to the field. | |
| 524 | - $attributes['role'] = $is_radio ? 'radiogroup' : 'group'; | |
| 525 | - | |
| 526 | - // Add 'aria-required' attribute to the field if required. | |
| 527 | - if ( $type_requires_aria_required && '1' === $field['required'] ) { | |
| 528 | - $attributes['aria-required'] = 'true'; | |
| 529 | - } | |
| 530 | - | |
| 531 | - // Add 'tabindex = "0"' attribute to the radio field. | |
| 532 | - if ( $is_radio ) { | |
| 533 | - $attributes['tabindex'] = 0; | |
| 534 | - } | |
| 535 | - | |
| 536 | - // Concatenate attributes into a string, and replace the role="group" in the HTML with the attributes string. | |
| 537 | - $html_attributes = FrmAppHelper::array_to_html_params( $attributes ); | |
| 538 | - $this->html = str_replace( ' role="group"', $html_attributes, $this->html ); | |
| 539 | 483 | } |
| 540 | 484 | } |