mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
pcp-48 / set correct title for setting tabs
This commit is contained in:
parent
7069925a30
commit
ce9e9d1308
2 changed files with 20 additions and 3 deletions
|
@ -310,6 +310,9 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
if ( $this->is_credit_card_tab() ) {
|
||||
return __( 'PayPal Card Processing', 'paypal-for-woocommerce' );
|
||||
}
|
||||
if ( $this->is_paypal_tab() ) {
|
||||
return __( 'PayPal Checkout', 'paypal-for-woocommerce' );
|
||||
}
|
||||
return __( 'PayPal', 'paypal-for-woocommerce' );
|
||||
}
|
||||
|
||||
|
@ -340,8 +343,22 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
* @return bool
|
||||
*/
|
||||
private function is_credit_card_tab() : bool {
|
||||
return is_admin() && isset( $_GET[ SectionsRenderer::KEY ] ) && CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
|
||||
return is_admin()
|
||||
&& isset( $_GET[ SectionsRenderer::KEY ] )
|
||||
&& CreditCardGateway::ID === sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether we are on the PayPal settings tab.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_paypal_tab() : bool {
|
||||
return ! $this->is_credit_card_tab()
|
||||
&& is_admin()
|
||||
&& isset( $_GET['section'] )
|
||||
&& self::ID === sanitize_text_field( wp_unslash( $_GET['section'] ) );
|
||||
}
|
||||
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ class SectionsRenderer {
|
|||
//phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$current = ! isset( $_GET[ self::KEY ] ) ? PayPalGateway::ID : sanitize_text_field( wp_unslash( $_GET[ self::KEY ] ) );
|
||||
$sections = array(
|
||||
PayPalGateway::ID => __( 'PayPal', 'paypal-for-woocommerce' ),
|
||||
CreditCardGateway::ID => __( 'Credit Card', 'paypal-for-woocommerce' ),
|
||||
PayPalGateway::ID => __( 'PayPal Checkout', 'paypal-for-woocommerce' ),
|
||||
CreditCardGateway::ID => __( 'PayPal Card Processing', 'paypal-for-woocommerce' ),
|
||||
);
|
||||
|
||||
echo '<ul class="subsubsub">';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue