mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add GooglePlay preview in admin settings.
This commit is contained in:
parent
5ca0e16b5b
commit
08d8cded5b
10 changed files with 208 additions and 13 deletions
|
@ -358,6 +358,34 @@ class Button implements ButtonInterface {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues scripts/styles for admin.
|
||||
*/
|
||||
public function enqueue_admin(): void {
|
||||
wp_register_style(
|
||||
'wc-ppcp-googlepay-admin',
|
||||
untrailingslashit( $this->module_url ) . '/assets/css/styles.css',
|
||||
array(),
|
||||
$this->version
|
||||
);
|
||||
wp_enqueue_style( 'wc-ppcp-googlepay-admin' );
|
||||
|
||||
wp_register_script(
|
||||
'wc-ppcp-googlepay-admin',
|
||||
untrailingslashit( $this->module_url ) . '/assets/js/boot-admin.js',
|
||||
array(),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
wp_enqueue_script( 'wc-ppcp-googlepay-admin' );
|
||||
|
||||
wp_localize_script(
|
||||
'wc-ppcp-googlepay-admin',
|
||||
'wc_ppcp_googlepay_admin',
|
||||
$this->script_data()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The configuration for the smart buttons.
|
||||
*
|
||||
|
|
|
@ -66,6 +66,21 @@ class GooglepayModule implements ModuleInterface {
|
|||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'admin_enqueue_scripts',
|
||||
static function () use ( $c, $button ) {
|
||||
if ( ! is_admin() ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Should add this to the ButtonInterface.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_admin();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'woocommerce_blocks_payment_method_type_registration',
|
||||
function( PaymentMethodRegistry $payment_method_registry ) use ( $c, $button ): void {
|
||||
|
@ -75,6 +90,16 @@ class GooglepayModule implements ModuleInterface {
|
|||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_admin_gateway_settings',
|
||||
function( array $settings ) use ( $c, $button ): array {
|
||||
if ( is_array( $settings['components'] ) ) {
|
||||
$settings['components'][] = 'googlepay';
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
);
|
||||
|
||||
// Clear product status handling.
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue