mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Fix the Apple Pay button in the editor
This commit is contained in:
parent
d1b4d7721e
commit
436fd77587
6 changed files with 112 additions and 28 deletions
|
@ -92,6 +92,7 @@ class ApplepayModule implements ModuleInterface {
|
|||
}
|
||||
|
||||
$module->load_admin_assets( $c, $apple_payment_method );
|
||||
$module->load_block_editor_assets( $c, $apple_payment_method );
|
||||
},
|
||||
1
|
||||
);
|
||||
|
@ -177,6 +178,13 @@ class ApplepayModule implements ModuleInterface {
|
|||
}
|
||||
}
|
||||
);
|
||||
add_action(
|
||||
'enqueue_block_editor_assets',
|
||||
function () use ( $c, $button ) {
|
||||
$button->enqueue_admin_styles();
|
||||
}
|
||||
);
|
||||
|
||||
add_action(
|
||||
'woocommerce_blocks_payment_method_type_registration',
|
||||
function( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void {
|
||||
|
@ -207,6 +215,7 @@ class ApplepayModule implements ModuleInterface {
|
|||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_admin();
|
||||
$button->enqueue_admin_styles();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -222,6 +231,21 @@ class ApplepayModule implements ModuleInterface {
|
|||
);
|
||||
}
|
||||
|
||||
public function load_block_editor_assets( ContainerInterface $c, ApplePayButton $button ): void {
|
||||
// Enqueue backend scripts.
|
||||
add_action(
|
||||
'enqueue_block_editor_assets',
|
||||
static function () use ( $c, $button ) {
|
||||
/**
|
||||
* Should add this to the ButtonInterface.
|
||||
*
|
||||
* @psalm-suppress UndefinedInterfaceMethod
|
||||
*/
|
||||
$button->enqueue_admin_styles();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Apple Pay buttons in the enabled places.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue