| @@ -7,9 +7,19 @@ | ||
| 7 | 7 | * Show the radio field on the front-end. |
| 8 | 8 | * Extra line breaks show as space on the front-end when |
| 9 | 9 | * the form is double filtered and not minimized. |
| 10 | 10 | * |
| 11 | + * @var array $field | |
| 12 | + * @var string $field_name | |
| 13 | + * @var bool $read_only | |
| 14 | + * @var string $html_id | |
| 15 | + * @var array|null $args | |
| 16 | + * | |
| 11 | 17 | * @phpcs:disable Generic.WhiteSpace.ScopeIndent |
| 18 | + * | |
| 19 | + * @since 6.30 Added `$hide_label`. | |
| 20 | + * | |
| 21 | + * @var bool $hide_label | |
| 12 | 22 | */ |
| 13 | 23 | |
| 14 | 24 | if ( isset( $field['post_field'] ) && $field['post_field'] === 'post_category' ) { |
| 15 | 25 | $type = $field['type']; |
| @@ -17,9 +27,8 @@ | ||
| 17 | 27 | } elseif ( is_array( $field['options'] ) ) { |
| 18 | 28 | if ( FrmFieldsHelper::should_skip_rendering_choices_for_field( $field ) ) { |
| 19 | 29 | return; |
| 20 | 30 | } |
| 21 | - $include_label = ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label']; | |
| 22 | 31 | |
| 23 | 32 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 24 | 33 | if ( isset( $shortcode_atts ) && isset( $shortcode_atts['opt'] ) && $shortcode_atts['opt'] !== $opt_key ) { |
| 25 | 34 | continue; |
| @@ -46,9 +55,9 @@ | ||
| 46 | 55 | |
| 47 | 56 | $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
| 48 | 57 | $should_echo_disabled_att = FrmFieldsHelper::should_disable_choice( $opt_key, trim( $checked ) !== '', $field ); |
| 49 | 58 | |
| 50 | - if ( $include_label ) { | |
| 59 | + if ( empty( $hide_label ) ) { | |
| 51 | 60 | $label_attributes = array( |
| 52 | 61 | 'for' => $html_id . '-' . $opt_key, |
| 53 | 62 | ); |
| 54 | 63 | |
| @@ -72,10 +81,9 @@ | ||
| 72 | 81 | if ( $should_echo_disabled_att ) { |
| 73 | 82 | echo 'disabled="disabled" '; |
| 74 | 83 | } |
| 75 | 84 | ?>/><?php |
| 76 | - | |
| 77 | - if ( $include_label ) { | |
| 85 | + if ( empty( $hide_label ) ) { | |
| 78 | 86 | echo ' '; |
| 79 | 87 | FrmAppHelper::kses_echo( $label, 'all' ); |
| 80 | 88 | FrmFieldsHelper::after_choice_input( $field, $opt_key ); |
| 81 | 89 | echo '</label>'; |