🐛 Load button preview JS on ACDC settings page

Renamed the DI service name; this service is only used in two places (APM modules), which were also updated.
This commit is contained in:
Philipp Stracker 2024-06-05 18:05:06 +02:00
parent ebb1f6962f
commit d69fb5bc70
No known key found for this signature in database
3 changed files with 18 additions and 5 deletions

View file

@ -205,7 +205,7 @@ class ApplepayModule implements ModuleInterface {
add_action( add_action(
'admin_enqueue_scripts', 'admin_enqueue_scripts',
static function () use ( $c, $button ) { static function () use ( $c, $button ) {
if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-standard-payments-page' ) ) { if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-payment-methods-page' ) ) {
return; return;
} }

View file

@ -112,7 +112,7 @@ class GooglepayModule implements ModuleInterface {
add_action( add_action(
'admin_enqueue_scripts', 'admin_enqueue_scripts',
static function () use ( $c, $button ) { static function () use ( $c, $button ) {
if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-standard-payments-page' ) ) { if ( ! is_admin() || ! $c->get( 'wcgateway.is-ppcp-settings-payment-methods-page' ) ) {
return; return;
} }

View file

@ -201,9 +201,22 @@ return array(
); );
}, },
'wcgateway.is-ppcp-settings-standard-payments-page' => static function ( ContainerInterface $container ): bool { // Checks, if the current admin page contains settings for this plugin's payment methods.
return $container->get( 'wcgateway.is-ppcp-settings-page' ) 'wcgateway.is-ppcp-settings-payment-methods-page' => static function ( ContainerInterface $container ) : bool {
&& $container->get( 'wcgateway.current-ppcp-settings-page-id' ) === PayPalGateway::ID; if ( ! $container->get( 'wcgateway.is-ppcp-settings-page' ) ) {
return false;
}
$active_tab = $container->get( 'wcgateway.current-ppcp-settings-page-id' );
return in_array(
$active_tab,
array(
PayPalGateway::ID,
CreditCardGateway::ID,
),
true
);
}, },
'wcgateway.current-ppcp-settings-page-id' => static function ( ContainerInterface $container ): string { 'wcgateway.current-ppcp-settings-page-id' => static function ( ContainerInterface $container ): string {