| @@ -5,14 +5,17 @@ | ||
| 5 | 5 | * This template can be overridden by copying it to yourtheme/learnpress/checkout/payment-method.php. |
| 6 | 6 | * |
| 7 | 7 | * @author ThimPress |
| 8 | 8 | * @package Learnpress/Templates |
| 9 | - * @version 4.0.0 | |
| 9 | + * @version 4.0.2 | |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | defined( 'ABSPATH' ) || exit(); |
| 13 | 13 | |
| 14 | -if ( ! isset( $gateway ) || ! $gateway->is_display() ) { | |
| 14 | +/** | |
| 15 | + * @var LP_Gateway_Abstract $gateway | |
| 16 | + */ | |
| 17 | +if ( ! isset( $gateway ) ) { | |
| 15 | 18 | return; |
| 16 | 19 | } |
| 17 | 20 | |
| 18 | 21 | $icon = $gateway->get_icon(); |
| @@ -21,18 +24,21 @@ | ||
| 21 | 24 | <li id="learn-press-payment-method-<?php echo esc_attr( $gateway->id ); ?>" |
| 22 | 25 | class="lp-payment-method lp-payment-method-<?php echo esc_attr( $gateway->id ); ?><?php echo esc_html( $gateway->is_selected ? ' selected' : '' ); ?>"> |
| 23 | 26 | <label for="payment_method_<?php echo esc_attr( $gateway->id ); ?>"> |
| 24 | 27 | <input type="radio" class="gateway-input" name="payment_method" |
| 25 | - id="payment_method_<?php echo esc_attr( $gateway->id ); ?>" | |
| 26 | - value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->is_selected, true ); ?> | |
| 27 | - data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>"/> | |
| 28 | + id="payment_method_<?php echo esc_attr( $gateway->id ); ?>" | |
| 29 | + value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->is_selected, true ); ?> | |
| 30 | + data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>"/> | |
| 28 | 31 | <?php echo wp_kses_post( ! empty( $icon ) ? $icon : $gateway->get_title() ); ?> |
| 29 | 32 | </label> |
| 30 | 33 | |
| 31 | - <?php $payment_form = $gateway->get_payment_form(); ?> | |
| 32 | - | |
| 33 | - <?php if ( $payment_form ) : ?> | |
| 34 | - <div class="payment-method-form payment_method_<?php echo esc_attr( $gateway->id ); ?>"> | |
| 35 | - <?php learn_press_echo_vuejs_write_on_php( $payment_form ); ?> | |
| 34 | + <?php | |
| 35 | + $payment_form = $gateway->get_payment_form(); | |
| 36 | + $style = $gateway->is_selected ? 'display: block' : 'display: none'; | |
| 37 | + if ( ! empty( $payment_form ) ) : | |
| 38 | + ?> | |
| 39 | + <div class="payment-method-form payment_method_<?php echo esc_attr( $gateway->id ); ?>" | |
| 40 | + style="<?php echo esc_attr( $style ); ?>"> | |
| 41 | + <?php echo $payment_form; ?> | |
| 36 | 42 | </div> |
| 37 | 43 | <?php endif; ?> |
| 38 | 44 | </li> |