| @@ -19,8 +19,9 @@ | ||
| 19 | 19 | $off_label = isset( $args['off_label'] ) ? $args['off_label'] : ''; |
| 20 | 20 | $on_label = isset( $args['on_label'] ) ? $args['on_label'] : 1; |
| 21 | 21 | $value = isset( $args['value'] ) ? $args['value'] : $on_label; |
| 22 | 22 | $checked = isset( $args['checked'] ) && ( true === $args['checked'] || false !== strpos( $args['checked'], 'checked="checked"' ) ); |
| 23 | +$disabled = ! empty( $args['disabled'] ); | |
| 23 | 24 | $aria_checked = $checked ? 'true' : 'false'; |
| 24 | 25 | $input_html = isset( $args['input_html'] ) ? $args['input_html'] : array(); |
| 25 | 26 | |
| 26 | 27 | $use_container = false; |
| @@ -47,9 +48,9 @@ | ||
| 47 | 48 | } |
| 48 | 49 | ?> |
| 49 | 50 | <label class="frm_toggle_block" <?php FrmAppHelper::array_to_html_params( $div_params, true ); ?>> |
| 50 | 51 | <?php if ( $show_labels && $off_label ) { ?> |
| 51 | - <span class="frm_off_label frm_toggle_opt"><?php echo esc_html( $off_label ); ?></span> | |
| 52 | + <span class="frm_off_label frm_toggle_opt frm-leading-none"><?php echo esc_html( $off_label ); ?></span> | |
| 52 | 53 | <?php } ?> |
| 53 | 54 | |
| 54 | 55 | <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $value ); ?>" |
| 55 | 56 | <?php checked( $checked, true ); ?> |
| @@ -55,8 +56,11 @@ | ||
| 55 | 56 | <?php checked( $checked, true ); ?> |
| 56 | 57 | <?php if ( $show_labels && $off_label ) { ?> |
| 57 | 58 | data-off="<?php echo esc_attr( $off_label ); ?>" |
| 58 | 59 | <?php } ?> |
| 60 | + <?php if ( $disabled ) { ?> | |
| 61 | + disabled | |
| 62 | + <?php } ?> | |
| 59 | 63 | <?php |
| 60 | 64 | if ( is_array( $input_html ) ) { |
| 61 | 65 | FrmAppHelper::array_to_html_params( $input_html, true ); |
| 62 | 66 | } else { |
| @@ -64,14 +68,18 @@ | ||
| 64 | 68 | } |
| 65 | 69 | ?> |
| 66 | 70 | /> |
| 67 | 71 | |
| 68 | - <span class="frm_toggle" tabindex="0" role="switch" aria-labelledby="<?php echo esc_attr( $id ); ?>_label" aria-checked="<?php echo esc_attr( $aria_checked ); ?>"> | |
| 72 | + <span class="frm_toggle" tabindex="0" role="switch" | |
| 73 | + <?php echo ! empty( $args['aria-label-attr'] ) ? 'aria-label="' . esc_attr( $args['aria-label-attr'] ) . '"' : ''; ?> | |
| 74 | + aria-labelledby="<?php echo esc_attr( $id ); ?>_label" | |
| 75 | + aria-checked="<?php echo esc_attr( $aria_checked ); ?>" | |
| 76 | + > | |
| 69 | 77 | <span class="frm_toggle_slider"></span> |
| 70 | 78 | </span> |
| 71 | 79 | |
| 72 | 80 | <?php if ( $show_labels && $on_label != 1 ) { ?> |
| 73 | - <span class="frm_on_label frm_toggle_opt"><?php echo FrmAppHelper::kses( $on_label, 'all' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span> | |
| 81 | + <span class="frm_on_label frm_toggle_opt frm-leading-none"><?php FrmAppHelper::kses_echo( $on_label, 'all' ); ?></span> | |
| 74 | 82 | <?php } ?> |
| 75 | 83 | </label> |
| 76 | 84 | <?php if ( $use_container ) { ?> |
| 77 | 85 | </div> |