| @@ -35,8 +35,30 @@ | ||
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | + * Show readonly setting icon | |
| 40 | + * | |
| 41 | + * @since 6.33 | |
| 42 | + * | |
| 43 | + * @param bool $is_enabled Whether the setting is enabled. | |
| 44 | + * | |
| 45 | + * @return void | |
| 46 | + */ | |
| 47 | + public static function show_readonly_setting_icon( $is_enabled ) { | |
| 48 | + if ( $is_enabled ) { | |
| 49 | + echo '<span class="frm-success-icon">'; | |
| 50 | + FrmAppHelper::icon_by_class( 'frmfont frm_checkmark_icon', array( 'aria-hidden' => 'true' ) ); | |
| 51 | + echo '</span>'; | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 55 | + echo '<span class="frm-x-icon">'; | |
| 56 | + FrmAppHelper::icon_by_class( 'frmfont frm_x_icon', array( 'aria-hidden' => 'true' ) ); | |
| 57 | + echo '</span>'; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 39 | 61 | * Echo a dropdown option. |
| 40 | 62 | * This is useful to avoid closing and opening PHP to echo <option> tags which leads to extra whitespace. |
| 41 | 63 | * Avoiding whitespace saves 5KB of HTML for an international address field with a country dropdown with 252 options. |
| 42 | 64 | * |
| @@ -98,9 +120,9 @@ | ||
| 98 | 120 | $value = $matches[1]; |
| 99 | 121 | } |
| 100 | 122 | } |
| 101 | 123 | |
| 102 | - $input_number_attrs = array_merge( | |
| 124 | + $input_number_attrs = array_merge( | |
| 103 | 125 | $args['input_number_attrs'], |
| 104 | 126 | array( |
| 105 | 127 | 'type' => ! empty( $selected_unit ) ? 'number' : 'text', |
| 106 | 128 | 'value' => $value, |
| @@ -112,14 +134,15 @@ | ||
| 112 | 134 | |
| 113 | 135 | if ( is_numeric( $hidden_value ) ) { |
| 114 | 136 | $hidden_value .= $args['default_unit']; |
| 115 | 137 | } |
| 138 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 116 | 139 | ?> |
| 117 | 140 | <span class="frm-unit-input"> |
| 118 | 141 | <input type="hidden" value="<?php echo esc_attr( $hidden_value ); ?>" <?php FrmAppHelper::array_to_html_params( $args['field_attrs'], true ); ?> /> |
| 119 | 142 | <input <?php FrmAppHelper::array_to_html_params( $input_number_attrs, true ); ?> /> |
| 120 | 143 | <span class="frm-input-group-suffix"> |
| 121 | - <select aria-label="<?php echo esc_attr__( 'Select unit', 'formidable' ); ?>" tabindex="0"> | |
| 144 | + <select aria-label="<?php esc_attr_e( 'Select unit', 'formidable' ); ?>" tabindex="0"> | |
| 122 | 145 | <?php |
| 123 | 146 | foreach ( $units as $unit ) { |
| 124 | 147 | self::echo_dropdown_option( $unit, $unit === ( $selected_unit ?? $args['default_unit'] ), array( 'value' => $unit ) ); |
| 125 | 148 | } |
| @@ -127,6 +150,7 @@ | ||
| 127 | 150 | </select> |
| 128 | 151 | </span> |
| 129 | 152 | </span> |
| 130 | 153 | <?php |
| 154 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 131 | 155 | } |
| 132 | 156 | } |